QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#666833 | #6607. Rise of Shadows | lonelywolf# | WA | 0ms | 3664kb | C++20 | 618b | 2024-10-22 20:08:57 | 2024-10-22 20:09:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int H, M, A;
cin >> H >> M >> A;
int x = H - 1, y = H * M;
int len = lcm(x, y) / x;
int cnt = y / len;
if (2 * A != y) {
int ans = cnt * (1 + (A / gcd(x, y)) + len - ((y - A - 1) / gcd(x, y) + 1));
cout << ans << "\n";
} else {
int ans = cnt * (1 + (A / gcd(x, y)) + len - ((y - A - 1) / gcd(x, y) + 1));
if (A % gcd(x, y) == 0) {
ans -= cnt;
}
cout << ans << "\n";
// assert(false);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
5 5 4
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
3 5 1
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
5 5 0
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
5 5 1
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
5 5 2
output:
5
result:
ok 1 number(s): "5"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
5 5 3
output:
7
result:
ok 1 number(s): "7"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
5 5 5
output:
11
result:
ok 1 number(s): "11"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
5 5 6
output:
13
result:
ok 1 number(s): "13"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
5 5 7
output:
15
result:
ok 1 number(s): "15"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 5 8
output:
17
result:
ok 1 number(s): "17"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
5 5 9
output:
19
result:
ok 1 number(s): "19"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
5 5 10
output:
21
result:
ok 1 number(s): "21"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5 5 11
output:
23
result:
ok 1 number(s): "23"
Test #14:
score: -100
Wrong Answer
time: 0ms
memory: 3664kb
input:
628383665 981360590 38277030565242771
output:
-5050849391744499968
result:
wrong answer 1st numbers differ - expected: '76554061130485542', found: '-5050849391744499968'