QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#409855 | #8111. Coaches | Dinal | WA | 0ms | 3900kb | C++14 | 551b | 2024-05-12 19:40:15 | 2024-05-12 19:40:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
long long panduan(long long c,long long a,long long b,long long d){
for(int i=0;i<b;++i)if((c+a*i)%b>=d){
return c+a*i;
}
return LLONG_MAX;
}
int main(){
int T;
scanf("%d",&T);
while(T--){
long long n;
int a,b;
scanf("%lld%d%d",&n,&a,&b);
long long l=1ll*a*b/__gcd(a,b);
long long yc=n/a+n/b-2*(n/l);
int ra=n%a,rb=n%b;
long long rl=n%l;
int ys=0;
if(panduan(ra,a,b,rb)<rl)ys=2;
if(panduan(rb,b,a,ra)<rl)ys=2;
printf("%lld\n",n-yc+ys);
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3900kb
input:
2 5 2 3 10 7 2
output:
2 6
result:
wrong answer 1st numbers differ - expected: '3', found: '2'