40分求调
查看原帖
40分求调
1799619
w_i_l_y楼主2025/7/24 09:48

一个WA\color{red}WA和2个TLE\color {blue} TLE,只有2个AC\color{green} AC,40分求调。

代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    for(int i=a;i>=1;i--){
        if((a%i)==0&&(b%i)==0){
            cout<<i<<" ";
            for(int j=1;j<=(a*b);j++){
                if((j%a)==0&&(j%b)==0){
                    cout<<j;
                    return 0;
                }
            }
        }
    }
    return 0;
}
2025/7/24 09:48
加载中...