QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#584886 | #7111. Press the Button | feng | WA | 0ms | 3644kb | C++20 | 1.0kb | 2024-09-23 17:23:33 | 2024-09-23 17:23:33 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define PII pair<int,int>
using namespace std;
int a, b, c, d, v, t;
int w;
int gcd(int a, int b) {
return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
int get(int r, bool flag) {
int now = 0;
int timer = 0;
int cnt = 0;
int xx = 0, yy = 0;
while (now <= r) {
if (now % a == 0) {
xx += a;
cnt += b;
}
if (now % c == 0) {
yy += c;
cnt += d;
}
if (now >= timer) {
cnt--;
}
timer = now + v + 1;
now = min(xx, yy);
}
if (flag && timer > r + 1) w = 1;
return cnt;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int T; cin >> T;
while (T--) {
cin >> a >> b >> c >> d >> v >> t;
w = 0;
int l = lcm(a, c);
if (t < l) {
cout << get(t, 0) << endl;
continue;
}
int x = get(l - 1, 1);
int y = get(t % l, 0);
cout << x << " " << y << endl;
cout << (x + w) * (t / l) + y << endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3644kb
input:
2 8 2 5 1 2 18 10 2 5 1 2 10
output:
6 2 2 4
result:
wrong answer 2nd numbers differ - expected: '4', found: '2'