1 solutions

  • 0
    @ 2025-11-5 15:13:02

    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

    Information

    ID
    16528
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By