QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#807909#9868. GCDayaCompile Error//C++23451b2024-12-10 14:35:012024-12-10 14:35:02

Judging History

你现在查看的是最新测评结果

  • [2024-12-10 14:35:02]
  • 评测
  • [2024-12-10 14:35:01]
  • 提交

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);
      |              ^~~~~~