#27867: LOL


mango971218@gmail.com (永夜ʟᴏͥᴠͣᴇͫγou)

School : No School
ID : 167425
IP address : [203.72.178.1]
Last Login :
2022-03-11 13:45:09
a024. 最大公因數(GCD) | From: [203.72.178.1] | Post Date : 2021-11-03 17:18

#include<iostream>

using namespace std;

int main()

{

    int a,b;

    while(cin>>a>>b){

        while(a!=0 && b!=0){

            a>b? a=a%b: b=b%a;

        }

        if (a==0) cout<<b<<endl;

        else cout<<a<<endl;

    }

}

 
ZeroJudge Forum