4 条题解

  • 0
    @ 2026-4-20 12:09:23

    辗转相除

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        int a,b;
       while(n--){
        cin>>a>>b;
        int m,t;
        t=a*b;
        while(b!=0){
            m=b;
            b=a%b;
            a=m;
        }
        cout<<m<<" "<<t/m<<endl;
       }
        return 0;
    }
    

    信息

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