不要让昨天 占据你的今天 夏午晴天

夏午晴天

gcd()

 1 #include <iostream>
 2 
 3 using namespace std;
 4 #define LL long long
 5 LL gcd(LL a, LL b)
 6 {
 7     if(a < b)
 8     {
 9         LL t = a;
10         a = b;
11         b = t;
12     }
13     return b==0?a:gcd(b, a%b);
14 }
15 int main()
16 {
17     LL a,b;
18     while(cin >> a >> b)
19     {
20         cout  << gcd(a,b) << endl;
21     }
22     return 0;
23 }

 

posted on 2017-03-07 16:29  夏晴天  阅读(121)  评论(0编辑  收藏  举报

导航

Live2D