QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#666523 | #6611. United in Stormwind | lonelywolf# | WA | 0ms | 3676kb | C++20 | 1.1kb | 2024-10-22 18:54:30 | 2024-10-22 18:54:36 |
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 ans = 0;
// for (int k = 0; k < H; k++) {
// int l = ceil(1.0 * (k * M - A) / (H - 1));
// int r = floor(1.0 * (k * M + A) / (H - 1));
// l = max(l, 0LL), r = min(r, M - 1);
// cerr << l << " " << r << "\n";
// // ans += r - l + 1;
// }
for (int l = 0, r; l < H; l = r + 1) {
if ((l * M + A) / (H - 1) >= M) {
ans += (H - l) * (M - 1);
break;
}
int d = (H - 1) - (l * M + A) % (H - 1);
int st = d / M - (d % M == 0);
r = l + st;
ans += (r - l + 1) * ((l * M + A) / (H - 1));
}
for (int l = 0, r; l < H; l = r + 1) {
if (l * M - A <= 0) {
r = A / M;
continue;
}
int d = (H - 1) - (l * M - A) % (H - 1);
int st = d / M;
r = l + st;
// cerr << l << " " << r << " " << (l * M - A + H - 2) / (H - 1) << "\n";
int sub = (r - l + 1) * ((l * M - A + H - 2) / (H - 1));
// cerr << sub << "\n";
ans -= sub;
}
ans += H;
cout << ans << "\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
2 2 1 AA BB
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3676kb
input:
2 2 1 AA AB
output:
3
result:
wrong answer 1st numbers differ - expected: '2', found: '3'