test/cpv/aizu-ntl/ntl_1_c.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/all/NTL_1_C | ||
| 2 | #include "../../../src/io/fastin/lib.hpp" | ||
| 3 | #include "../../../src/io/fastout/lib.hpp" | ||
| 4 | #include "../../../src/nt/gl/lcm/lib.hpp" | ||
| 5 | #include "../../../src/nt/gl/rgcd/lib.hpp" | ||
| 6 | |||
| 7 | using namespace tifa_libs; | ||
| 8 | CEXP u32 LIMIT = 1e7; | ||
| 9 | |||
| 10 | 20 | int main() { | |
| 11 | u64 n; | ||
| 12 | u32 ans; | ||
| 13 | 20 | fin_uint >> n >> ans; | |
| 14 | 20 | rgcd rgcd_(LIMIT); | |
| 15 |
2/2✓ Branch 0 taken 117 times.
✓ Branch 1 taken 20 times.
|
137 | for (u32 i = 1, x; i < n; ++i) { |
| 16 | 117 | fin_uint >> x; | |
| 17 |
2/2✓ Branch 0 taken 114 times.
✓ Branch 1 taken 3 times.
|
117 | if (ans < LIMIT) (ans /= rgcd_(ans, x)) *= x; |
| 18 | 3 | else ans = lcm(ans, x); | |
| 19 | } | ||
| 20 | 20 | fout << ans << '\n'; | |
| 21 | 20 | return 0; | |
| 22 | 20 | } | |
| 23 |