QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#808405#9868. GCDlbssssssCompile Error//C++14542b2024-12-10 20:35:222024-12-10 20:35:22

Judging History

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

  • [2024-12-10 20:35:22]
  • 评测
  • [2024-12-10 20:35:22]
  • 提交

answer

#include<bits/stdc++.h>

#define int long long

int solve(int a,int b){
    if(a==0 && b==0)return 0;
    if(a==0||b==0)return 1;
    int g = std::gcd(a,b);
    int k1 = a / g, k2 = b / g; 
    if(k1==1){
        return solve(0,b-g)+1;
    }
    if(k1%2){
        return solve(a-g,b)+1;
    }
    return solve(a,b-g)+1;
}

void solve(){
    int a,b;
    std::cin >> a >> b; 

    std::cout<<solve(a,b)<<"\n";


}
 
signed main(){
    
    int t = 1;
    std::cin >> t;
    while(t--)solve();

    return 0;
}

Details

answer.code: In function ‘long long int solve(long long int, long long int)’:
answer.code:8:18: error: ‘gcd’ is not a member of ‘std’
    8 |     int g = std::gcd(a,b);
      |                  ^~~