Task: | Pallo |
Sender: | cowperso |
Submission time: | 2022-01-22 15:05:54 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 10 |
#2 | ACCEPTED | 35 |
#3 | ACCEPTED | 55 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#2 | ACCEPTED | 0.01 s | 2, 3 | details |
#3 | ACCEPTED | 0.01 s | 3 | details |
Code
#include <iostream> uint64_t suuryht(uint64_t a, uint64_t b) { uint64_t siirto = 0; if (a == 0) return b; if (b == 0) return a; while (((a | b) & 1) == 0) { siirto++; a >>= 1; b >>= 1; } while ((a & 1) == 0) a >>= 1; do { while ((b & 1) == 0) b >>= 1; if (a > b) std::swap(a, b); b -= a; } while (b != 0); return a << siirto; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); uint32_t t; std::cin >> t; for (uint32_t i = 0; i < t; ++i) { uint64_t n, m, k; std::cin >> n >> m >> k; std::cout << k / (n - 1) + k / (m - 1) - k / ((n - 1) * (m - 1) / suuryht(n - 1, m - 1)) << '\n'; } }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 10 5 76 9 8 78 8 6 49 3 3 94 ... |
correct output |
---|
25 19 15 47 8 ... |
user output |
---|
25 19 15 47 8 ... Truncated |
Test 2
Group: 2, 3
Verdict: ACCEPTED
input |
---|
1000 7 5 99033171167123849 6 8 472883555390027162 9 10 258937093512465880 10 6 691774305483997493 ... |
correct output |
---|
33011057055707949 148620545979722822 57541576336103529 199845910473154830 52151060432923288 ... |
user output |
---|
33011057055707949 148620545979722822 57541576336103529 199845910473154830 5215106043292328 ... Truncated |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
1000 816332614 86098803 33572721929... |
correct output |
---|
4310587870 45982113074 1550250683 717639357 3282221941 ... |
user output |
---|
4310587870 45982113074 1550250683 717639357 3282221941 ... Truncated |