#115: a


s198 (周品勛)

學校 : 不指定學校
編號 : 233
來源 : [118.163.232.198]
最後登入時間 :
2026-01-10 11:50:11
t020. 210 選擇敘述與迴圈 (最大公因數與最小公倍數) | From: [118.163.232.198] | 發表日期 : 2026-01-10 11:12

#include<bits/stdc++.h>
using namespace std;
int a,b;
int gcd(int a,int b)
{
    if(a%b==0)
        return b;
    else
        return gcd( b, a%b);

}

int main()
{
    cin>>a>>b;
    printf("%d\n%d",gcd(a,b),a*b/gcd(a,b));
    return 0;

}
 
ZeroJudge Forum