QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#447883 | #8758. Menji 和 gcd | Fire_Fly# | TL | 0ms | 0kb | C++20 | 1.4kb | 2024-06-18 23:24:03 | 2024-06-18 23:24:04 |
Judging History
answer
// _____ _ _____ _____ _____ _ __ __
// | ___| | | | _ \ | ____| | ___| | | \ \ / /
// | |__ | | | |_| | | |__ | |__ | | \ \/ /
// | __| | | | _ / | __| | __| | | \ /
// | | | | | | \ \ | |___ | | | |___ / /
// |_| |_| |_| \_\ |_____| |_| |_____| /_/
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define lowbit(i) ((i) & -(i))
#define ull unsigned long long
#define int long long
// #define ll long long
#define Genshin_Impact return
#define Starts 0
#define endl '\n'
using namespace std;
const int mod = 998244353;
const int N = 2e5 + 10;
int a, b;
int ans;
bool check(int i)
{
int x = ((a + i - 1) / i) * i;
int y = (b / i) * i;
return y > x;
}
void js(int l, int r)
{
if (r < l)
return;
int mid = (l + r) >> 1;
if (mid <= ans)
return;
if (check(mid))
{
ans = mid;
js(mid + 1, r);
return;
}
js(l, mid - 1);
js(mid + 1, r);
}
void Automatic_AC_machine()
{
cin >> a >> b;
ans = 1;
js(1, b - a + 1);
cout << ans << endl;
return;
}
signed main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int tt = 1;
cin >> tt;
while (tt--)
{
Automatic_AC_machine();
}
Genshin_Impact Starts;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
10 1 2 2 4 6 10 11 21 147 154 1470 1540 2890 3028 998244353 1000000007 34827364537 41029384775 147147147147 154154154154