1 条题解

  • 0
    @ 2024-12-24 9:14:33

    C++ :

    #include <cstdio>
    #include <iostream>
    #include <cmath>
    #include <algorithm>
    using namespace std;
    typedef long long LL;
    LL gcd(LL a,LL b){
        if(b==0) return a; return gcd(b,a%b);
    }
    int main(){
        LL a,b;
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
        while(scanf("%lld%lld",&a,&b)!=EOF){
            printf("%lld\n",a+b-gcd(a,b));
        }
        return 0;
    }
    
    
    • 1

    信息

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