首页 > 其他 > 详细

【codeforces 19/11/06 div2】C. Tile Painting

时间:2019-11-09 00:26:24      阅读:73      评论:0      收藏:0      [点我收藏+]
技术分享图片
 1 #include <iostream>
 2 using namespace std;
 3  
 4 typedef long long LL;
 5  
 6 LL gcd(LL a, LL b)
 7 {
 8     if (!b) return a;
 9     return gcd(b, a % b);
10 }
11  
12 int min(int a, int b)
13 {
14     return a < b ? a : b;
15 }
16  
17 int main() 
18 {
19     LL x;
20     cin >> x;
21     LL div = x;
22     LL i = 2;
23     while (i * i <= x)
24     {
25         if (x % i == 0) div = gcd(div, gcd(i, x / i));
26         if (i & 1) i++;
27         i++;
28     }
29     cout << min(div, x) << endl;
30 }
View Code

 

【codeforces 19/11/06 div2】C. Tile Painting

原文:https://www.cnblogs.com/thjkhdf12/p/11823798.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!