随笔分类 -  数论

摘要:DescriptionGiven 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x... 阅读全文
posted @ 2015-08-05 18:15 Bug_Clearlove 阅读(540) 评论(0) 推荐(0)
摘要:Euler is a well-known matematician, and, among many other things, he discovered that the formula n 2 + n + 41 produces a prime for 0 ≤ n #include #inc... 阅读全文
posted @ 2015-08-05 17:38 Bug_Clearlove 阅读(296) 评论(0) 推荐(0)
摘要:DescriptionConsider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the re... 阅读全文
posted @ 2015-08-05 17:11 Bug_Clearlove 阅读(416) 评论(0) 推荐(0)
摘要:DescriptionYou are given a non-negative integern, its decimal representation consists of at most100digits and doesn't contain leading zeroes.Your task... 阅读全文
posted @ 2015-08-05 02:48 Bug_Clearlove 阅读(505) 评论(0) 推荐(0)
摘要:Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个... 阅读全文
posted @ 2015-08-05 02:42 Bug_Clearlove 阅读(240) 评论(0) 推荐(0)
摘要:Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers.InputThe first line of input... 阅读全文
posted @ 2015-08-05 00:00 Bug_Clearlove 阅读(323) 评论(0) 推荐(0)
摘要:给定a,b,c,d, 满足bc>ad, 求使得cn−d⌊abn⌋最小的最小的n.数据规模:1≤a,b,c,d≤1018令y=⌊abx⌋,x=⌈bya⌉, 原问题等价于求cx−dy的最小值,ax≥by,x≥1,y≥0.分两种情况考虑1.a≥b令k=⌊ab⌋,y≥kx,c>ad/b≥kd令a′=a−kb... 阅读全文
posted @ 2015-05-06 13:18 Bug_Clearlove 阅读(271) 评论(0) 推荐(0)
摘要:完数6、28、496、8128、33550336 阅读全文
posted @ 2015-04-10 00:05 Bug_Clearlove 阅读(110) 评论(0) 推荐(0)
摘要:a,b,c三道题有A,B,C三个答案。错排就是这三道题有多少种错误答案。公式:a[i]=(i-1)*(a[i-1]+a[i-2]);a[1]=0;a[2]=1; 阅读全文
posted @ 2015-04-10 00:03 Bug_Clearlove 阅读(140) 评论(0) 推荐(0)
摘要:I -Conspiracy Theory and RebrandingTime Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeURAL 2032DescriptionToday is ... 阅读全文
posted @ 2015-04-09 23:45 Bug_Clearlove 阅读(405) 评论(0) 推荐(0)
摘要:汉诺塔的水题(还没有遇到难的QAQ)一般都是一层层来求!公式:a[i]=a[i-1]*2+1;a[1]=1;a[i]表示从A上把i层移到另一个的步数。 阅读全文
posted @ 2015-04-09 23:00 Bug_Clearlove 阅读(156) 评论(0) 推荐(0)
摘要:#include using namespace std;int cmn(int n,int m){ int ans=1; for(int i=1;i>n>>m) { cout<<cmn(n,m)<<endl; } return 0;}View Code 阅读全文
posted @ 2015-04-09 22:42 Bug_Clearlove 阅读(267) 评论(0) 推荐(0)