QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#761343#8758. Menji 和 gcdzshhWA 2ms3596kbC++14496b2024-11-18 22:13:312024-11-18 22:13:32

Judging History

This is the latest submission verdict.

  • [2024-11-18 22:13:32]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3596kb
  • [2024-11-18 22:13:31]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
void solve(){
    ll res = 0;
    int L, R;
    cin >> L >> R;
    res = 1;
    for(int i = 2; i * i <= R; i++){
        int gcd = R / i;
        if((i - 1) * gcd >= L) res = max(res, gcd);
    }
    cout << res << '\n';
}
signed main() {
    ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0); 
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3596kb

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

result:

wrong answer 5th numbers differ - expected: '7', found: '1'