QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#430055 | #8758. Menji 和 gcd | wifi32767 | TL | 1952ms | 3688kb | C++20 | 5.2kb | 2024-06-03 12:26:13 | 2024-06-03 12:26:13 |
Judging History
answer
/*
____
/| | | | l
厂l | | | |
| | | | | |
| |_|_|_|_|
{ 个__o__}
/|:i:厂\:i:i:i:i:i/^㍉
八 ./:i:|//¨ヽ  ̄ 彡、}
i{ \ .'/ハ| 艾_0 /<07|Y
,i{ 寸 .i人__| {:. |ノ
i{ 寸 |:i:i:i:i:i: /:. ,'|
,i{ 寸 |:i:i:i:i八 /──-〉 /i| 那么开始投下
,i{ 寸 乂:i:i:i:| \ ./:iノ
.i{ V .才:| ≧寸彡ニ\
V .斗チ/ニl| /ニニ ー-
乂 -─<{ / .|ニニ|| ./ニニ. / .V
` < ∧ 寸厂V / .|ニニ|| /ニニ / ∨/
 ̄\ \ 寸 / |ニニ|| //ニニ / ∨/
/ >v \ / .| |ニニ|| .//ニニ | .V/
/ /./ 〉ハ', / | |ニニ||//ニニ. | .∨/
.{ / / ∨.|ニ\ / | |ニニ||/ニニ | ∨/
.\. / /Vノニニ.\ ./ | |ニニ|ニニ | ∨/
\ ∨厂`)ニ. 寸< .| |ニニ|ニニ| | .∨/
.\ 乂/ニ \ \ | |\|ニニニニニ|.∧ | ∨/
|ー::ニニニ | | .| |二ニニニニニニ|. | .∨/
|ーニニニ | ⌒/ニニニ{ 寸 | ∨/
|ーニニニ | ./二/ Vニ. | ∨/
|ーニニニ | /二/ |ニニ |
|=ニニニ | /二/ .|ニニ | ┛
*/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define yes cout << "YES\n"
#define no cout << "NO\n"
// #define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<ll, ll>;
const int MAX = 1e6 + 10;
const ll mod = 1e9 + 7;
int n;
ll l, r;
void solve(){
cin >> l >> r;
ll lk = 1, rk = r - l;
for (ll i = r - l; i >= 1; i --){
if ((l - 1) / i + 1 < r / i){
cout << i << endl;
break;
}
}
// while (lk < rk){
// ll mid = (lk + rk + 1) >> 1;
// if ((l - 1) / mid + 1 < r / mid) lk = mid;
// else rk = mid - 1;
// cerr << lk << ' ' << rk << ' ';
// }
// cout << lk << endl;
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// cout << fixed << setprecision(12);
// init();
int _;cin>>_;while (_ --)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1952ms
memory: 3688kb
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
Time Limit Exceeded
input:
6 357134483534 646200407704 504479652692 514965927651 831245941727 837097365832 778543598197 990152196633 19580905336 99295489037 228262697783 935881261360