QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#482325 | #7111. Press the Button | lwenj | WA | 0ms | 3588kb | C++14 | 822b | 2024-07-17 18:56:18 | 2024-07-17 18:56:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int a,b,c,d,v,t;
cin>>a>>b>>c>>d>>v>>t;
int g = __gcd(a,c);
int B = a/g*c;
int u = t%B;
int ans=0;
int l = 0;
int k = 0;
int si = 0;
int c1 = 0, c2 = 0;
for(int i = 0;i<B;){
if(i == 0){
ans += b+d-1;
k = i+v;
}
else{
if(i % a == 0){
ans += b - 1;
if(i<=k)ans++;
k = i+v;
}
if(i%c==0){
ans+=d-1;
if(i<=k)ans++;
k = i+v;
}
}
if(i >= u) si = ans;
if ((c1 + 1) * a < (c2 + 1) * c) {
i = (c1 + 1) * a;
c1++;
}
else {
i = (c2 + 1) * c;
c2++;
}
}
int f = 0;
if(k>=B){
f= 1;
}
cout << t/B*ans+si+f*(t/B)<<endl;
}
signed main()
{
int t;
cin >> t;
while(t--)
solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3588kb
input:
2 8 2 5 1 2 18 10 2 5 1 2 10
output:
10 4
result:
wrong answer 1st numbers differ - expected: '6', found: '10'