QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#593786 | #8758. Menji 和 gcd | Jingulu | WA | 58ms | 3624kb | C++17 | 655b | 2024-09-27 16:01:00 | 2024-09-27 16:01:00 |
Judging History
answer
#include <iostream>
#define int long long
using namespace std;
int gcd(int a,int b){
return b?gcd(b,a%b):a;
}
signed main(){
int t;
cin>>t;
while(t--){
int l,r;
cin>>l>>r;
int ans=0;
for(int i=1;i<=1e6;i++){
int x=l/i;
int rx=i*x+x;
if(l%i!=0){
rx+=x;
}
if(rx<=r){
ans=max(ans,x);
}
x=r/i;
int lx=x*i-x;
if(lx>=l){
ans=max(ans,x);
}
}
cout<<ans<<endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 58ms
memory: 3624kb
input:
10 1 2 2 4 6 10 11 21 147 154 1470 1540 2890 3028 998244353 1000000007 34827364537 41029384775 147147147147 154154154154
output:
1 2 3 7 9 70 126 1754385 5861340682 7007007007
result:
wrong answer 5th numbers differ - expected: '7', found: '9'