QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#806380 | #9868. GCD | zhangwansen | TL | 0ms | 0kb | C++23 | 772b | 2024-12-09 09:17:07 | 2024-12-09 09:17:08 |
answer
#include<bits/stdc++.h>
#define int unsigned long long
#define PII pair<int,int>
using namespace std;
mt19937_64 mrand(time(0));
map<PII,int> s;
int dfs(int a,int b,int dpt,int maxn)
{
if(dpt > maxn) return 1e9;
if(a * b == 0) return 1;
int GCD = __gcd(a,b);
a /= GCD,b /= GCD;
return min(dfs(a - 1,b,dpt + 1,maxn),dfs(a,b - 1, dpt + 1,maxn)) + 1;
}
int sum = 0;
void solve()
{
int a ,b;
cin >> a >> b;
a = mrand(),b = mrand();
sum += a;
if(1e5-sum > a) return;
cout << a << ' ' << b << endl;
cout << dfs(a,b,0,26) << endl;
}
signed main()
{
std::ios::sync_with_stdio(false);
cout.tie(0);
int t = 1;
cin >> t;
while(t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
3 3 4 12 20 114 514
output:
13460776292878960662 10760337125311934968