2 条题解

  • 0
    @ 2025-1-4 21:24:30

    爆切数论。

    #include<bits/stdc++.h>
    #define int long long
    #define INF 0x3f3f3f
    using namespace std;
    int a,b;
    signed main(){
    	while(cin>>a>>b)
    		cout<<a+b-__gcd(a,b)<<"\n";
    	return 0;
    }
    
    • 0
      @ 2024-12-22 11:03:59

      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
      181
      时间
      1000ms
      内存
      128MiB
      难度
      10
      标签
      递交数
      8
      已通过
      2
      上传者