QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#448895#8758. Menji 和 gcdokyh123WA 97ms3616kbC++17578b2024-06-20 11:23:352024-06-20 11:23:35

Judging History

This is the latest submission verdict.

  • [2024-06-20 11:23:35]
  • Judged
  • Verdict: WA
  • Time: 97ms
  • Memory: 3616kb
  • [2024-06-20 11:23:35]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve(){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    for(int l = 1,r;l <= a;l = r + 1){
        r = a / (a / l);
        int k = a / l + 1;
        int l1 = b / k,r1 = b / (k + 1);
        //cout << l << " " << r << " " << l1 << " " << r1 << "\n";
        if(r1 >= l)ans = max(ans,r1);
        if(a % (a / l) == 0 && l1 >= r)ans = max(ans,r);
    }
    cout << ans << "\n";
    return;
}

signed main() {
    int T;
    cin >> T;
    while(T--)solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 13ms
memory: 3616kb

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

result:

ok 10 numbers

Test #2:

score: -100
Wrong Answer
time: 97ms
memory: 3592kb

input:

6
357134483534 646200407704
504479652692 514965927651
831245941727 837097365832
778543598197 990152196633
19580905336 99295489037
228262697783 935881261360

output:

215400135901
10299318553
5813176151
198030439326
33098496345
311960420453

result:

wrong answer 5th numbers differ - expected: '49647744518', found: '33098496345'