MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / main

Function main

test/test_extended_gcd.cpp:21–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21int main() {
22 ios_base::sync_with_stdio(false);
23 cin.tie(nullptr);
24
25 vector<int> numbers = {11, 30, 24, 32, 50, 23, 11, 40, 47, 15, 30, 31, 0, 19, 23, 37, 48, 29, 37, 22};
26 for (auto i = 0u; i + 1 < numbers.size(); i++) {
27 int a = numbers[i];
28 int b = numbers[i + 1];
29
30 int x, y;
31 int g = e_maxx::gcd(a, b, x, y);
32 assert(g == std::gcd(a, b));
33 assert(x * a + y * b == g);
34
35 g = e_maxx_iter::gcd(a, b, x, y);
36 assert(g == std::gcd(a, b));
37 assert(x * a + y * b == g);
38 }
39}

Callers

nothing calls this directly

Calls 1

gcdFunction · 0.70

Tested by

no test coverage detected