QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425529#8758. Menji 和 gcdBYR_KKKWA 976ms3824kbC++14339b2024-05-30 12:56:252024-05-30 12:56:25

Judging History

This is the latest submission verdict.

  • [2024-05-30 12:56:25]
  • Judged
  • Verdict: WA
  • Time: 976ms
  • Memory: 3824kb
  • [2024-05-30 12:56:25]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long

int l,r,T;

signed main(){
	std::cin>>T;
	while(T--){
		std::cin>>l>>r;
		int len=r-l+1;
		for(int i=len;;i--){
			int x=l%i,y=i-x+l;
			if(x==0) y=0;
//			fprintf(stderr,"i=%lld x=%lld and y=%lld\n",i,x,y);
			if(r-y>=i){
				printf("%lld\n",i);
				break;
			}
		} 
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 976ms
memory: 3824kb

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
11
7
70
126
1754385
5861340682
7007007007

result:

wrong answer 4th numbers differ - expected: '7', found: '11'