随笔分类 -  数论

摘要:CoprimeTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 604Accepted Submission(s): 149 Problem DescriptionPlease write a program to calculate the k-th positive integer that is coprime with m and n simultaneously. A is coprime with B when their grea 阅读全文
posted @ 2013-09-27 22:11 线性无关 阅读(179) 评论(0) 推荐(0)
摘要:The Boss on MarsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1435Accepted Submission(s): 425 Problem DescriptionOn Mars, there is a huge company called ACM (A huge Company on Mars), and it’s owned by a younger boss.Due to no moons around Mars, 阅读全文
posted @ 2013-09-27 22:06 线性无关 阅读(142) 评论(0) 推荐(0)
摘要:盗用别人的,记录一下^_^#include#include#include#include#include#include#include#includeusing namespace std;int prime[40000],m;bool f[40000];vectorp;//存放质因数//用筛法初始化40000以内的质数,将质数存放在prime数组中,m记录大小int init(){ m=0; for(int i=2; i1) p.push_back(n);}//用二进制实现容斥原理,求区间[1,r]内与n互素的数的个数int solve(int r){ int sum ... 阅读全文
posted @ 2013-09-27 10:45 线性无关 阅读(211) 评论(0) 推荐(0)
摘要:Prime DistanceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9355Accepted: 2543DescriptionThe branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of primal. 阅读全文
posted @ 2013-05-26 16:40 线性无关 阅读(164) 评论(0) 推荐(0)
摘要:M斐波那契数列Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 426Accepted Submission(s): 115Problem DescriptionM斐波那契数列F[n]是一种整数数列,它的定义如下:F[0] = aF[1] = bF[n] = F[n-1] * F[n-2] ( n > 1 )现在给出a, b, n,你能求出F[n]的值吗?Input输入包含多组测试数据;每组数据占一行,包含3个整数a, b, n( 0 #i 阅读全文
posted @ 2013-05-26 03:25 线性无关 阅读(246) 评论(0) 推荐(0)