QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#807909 | #9868. GCD | aya | Compile Error | / | / | C++23 | 451b | 2024-12-10 14:35:01 | 2024-12-10 14:35:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int ans;
void f(int t,ll a,ll b){
if(a>b)swap(a,b);
if(!a){ans=t+1;return;}
if(t+1==ans)return;
ll G=__gccd(a,b%a);
f(t+1,a-G,b),f(t+1,a,b-G);
}
int main(){
ios::sync_with_stdio(false),cin.tie(0);
// for(int i=1;i<=5000;i++)for(int j=0;j<=i;j++)g[i][j]=j?g[j][i%j]:i;
int tc;cin>>tc;while(tc--){int a;ll b;cin>>a>>b,ans=2*(__lg(a)+1),f(0,a,b),cout<<ans<<'\n';}
}
Details
answer.code: In function ‘void f(int, ll, ll)’: answer.code:9:14: error: ‘__gccd’ was not declared in this scope 9 | ll G=__gccd(a,b%a); | ^~~~~~