1 条题解

  • 0
    @ 2026-10-2 2:21:39

    C++ :

    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #define N 1000010
    using namespace std;
    int calculate(int a,int b)
    {
        if(b==0)
            return a;
        return calculate(b,a%b);
    }
    int main()
    {
        int a,b;
        cin>>a>>b;
        if(a>b)
            cout<<calculate(a,b)<<endl;
        else
            cout<<calculate(b,a)<<endl;
        return 0;
    }
    
    • 1

    信息

    ID
    3883
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者