test/cpv/library-checker-number_theory/sum_of_floor_of_linear.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/sum_of_floor_of_linear | ||
| 2 | #include "../../../src/math/exeuclid/lib.hpp" | ||
| 3 | |||
| 4 | using namespace tifa_libs; | ||
| 5 | template <class T> | ||
| 6 | struct exeuclid_node { | ||
| 7 | T u, r; | ||
| 8 | T f; | ||
| 9 | 63384261 | exeuclid_node(T u = 0, T r = 0, T f = 0) : u(u), r(r), f(f) {} | |
| 10 | 51052651 | friend exeuclid_node operator*(exeuclid_node CR l, exeuclid_node CR r) { return {l.u + r.u, l.r + r.r, l.f + r.f + l.u * r.r}; } | |
| 11 | }; | ||
| 12 | |||
| 13 | 11 | int main() { | |
| 14 |
1/2✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
|
11 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 15 | u32 t; | ||
| 16 |
1/2✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
|
11 | std::cin >> t; |
| 17 | 11 | exeuclid_node<u64> u(1, 0, 0), r(0, 1, 0); | |
| 18 |
2/2✓ Branch 0 taken 383553 times.
✓ Branch 1 taken 11 times.
|
383564 | while (t--) { |
| 19 | u32 n, m, a, b; | ||
| 20 |
4/8✓ Branch 1 taken 383553 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 383553 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 383553 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 383553 times.
✗ Branch 11 not taken.
|
383553 | std::cin >> n >> m >> a >> b; |
| 21 |
2/4✓ Branch 2 taken 383553 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 383553 times.
✗ Branch 6 not taken.
|
383553 | std::cout << exeuclid<exeuclid_node<u64>>(a, m, b, n - 1, u, r).f + b / m << '\n'; |
| 22 | } | ||
| 23 | 11 | return 0; | |
| 24 | } | ||
| 25 |