QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#439671#8758. Menji 和 gcdship2077WA 32ms3832kbC++14397b2024-06-12 15:50:262024-06-12 15:50:28

Judging History

This is the latest submission verdict.

  • [2024-06-12 15:50:28]
  • Judged
  • Verdict: WA
  • Time: 32ms
  • Memory: 3832kb
  • [2024-06-12 15:50:26]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve(){ int L,R,ans=0;
	cin>>L>>R;L--;
	if (R/2>=L) return printf("%lld\n",R/2),void();
	for (int l=1,r;l<=R-L;l=r+1){
		r=min(R/(R/l),L/(L/l));
		if (R/r-L/r>1) ans=r;
	}
	printf("%lld\n",ans);
}
signed main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int T;cin>>T;while (T--) solve(); return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 32ms
memory: 3832kb

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

result:

wrong answer 3rd numbers differ - expected: '3', found: '5'