上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 33 下一页
摘要: 阶乘因式分解(一)时间限制:3000ms | 内存限制:65535KB难度:2描述给定两个数m,n,其中m是一个素数。将n(0 2 3 int Euler(int n,int m) 4 { 5 int k=0; 6 while(n) 7 { 8 n=n/m; 9 k=k+n;10 }11 return k;12 }13 14 int main()15 {16 int T,n,m;17 while(scanf("%d",&T)>0)18 {19 while(T--)20 ... 阅读全文
posted @ 2013-08-11 16:15 芷水 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 因子和阶乘时间限制:1000ms | 内存限制:65535KB难度:2http://acm.nyist.net/JudgeOnline/problem.php?pid=509描述给你一个正整数n,把n!=1x2x3x.....xn分解成素因子相乘的形式,并从小到大输出每个素因子的指数,但要保证最后输出的素因子个数不为0。例如825应表示为0,1,2,0,1表示分别有0,1,2,0,1个2,3,5,7,11。输入第一行有一个整数n(0N/p1^1+(N/p1^1)/p1^1+((N/p1^1)/p1^1)/p1^1;这样的话就可以写成一个solve函数。 1 #include 2 #includ 阅读全文
posted @ 2013-08-11 09:43 芷水 阅读(229) 评论(0) 推荐(0) 编辑
摘要: Problem 1075 分解素因子Accept: 1331Submit: 2523Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description假设x是一个正整数,它的值不超过65535(即1 7 #include 8 9 void Euler(int n)10 {11 int i,k=0;12 for(i=2;i*i0)39 {40 while(n--)41 {42 scanf("%d",&m);43 Euler(m);... 阅读全文
posted @ 2013-08-11 08:54 芷水 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 理论依据:代码: 1 /* 2 显然,数据够大的时候,数组要用 __int64 3 4 */ 5 6 #include 7 #include 8 #include 9 #include10 #include11 12 using namespace std;13 14 15 bool s[1000003];16 int num[1000003];//用来%j17 int ans[1000003];//保存和。18 19 void make_ini() //全部扫一遍。筛选一下。20 {21 int i,j,k,t;22 for(i=1;i0)53 {54 ... 阅读全文
posted @ 2013-08-10 18:27 芷水 阅读(314) 评论(0) 推荐(0) 编辑
摘要: Very Simple CountingTime Limit: 1 Second Memory Limit: 32768 KBLet f(n) be the number of factors of integer n.Your task is to count the number of i(1 4 #include 5 6 int f[1000003]; 7 int Num_Euler(int n) 8 { 9 int num=1,k,i;10 for(i=2;i*i0)37 {38 num=0;39 for(i=1;i 2 #... 阅读全文
posted @ 2013-08-10 17:41 芷水 阅读(347) 评论(0) 推荐(0) 编辑
摘要: Problem 1607 Greedy divisionhttp://acm.fzu.edu.cn/problem.php?pid=1607Accept: 402Submit: 1463Time Limit: 1000 mSecMemory Limit : 32768 KB Problem DescriptionOaiei has inherited a large sum of wealth recently; this treasure has n pieces of golden coins. Unfortunately, oaiei can not own this wealth al 阅读全文
posted @ 2013-08-10 12:20 芷水 阅读(216) 评论(0) 推荐(0) 编辑
摘要: /*二进制求最大公约数。由于传统的GCD,使用了%,在计算机运行过程中要花费大量的时间,所以,采取二进制的求法,来减少时间的消耗。算法:当a,b都是偶数时: gcd(a,b)=2*gcd(a/2,b/2);当a,b一奇一偶时: if(a&1) gcd(a,b)=gcd(a,b/2); else gcd(a,b)=gcd(a/2,b);当a,b都是奇数时: if(a>b) gcd(a,b)=gcd( (a-b)/2, b); else gcd(a,b)=gcd( a,(b-a)/2);其实就是把偶数的/2,而且奇数-奇数=偶数。*/ 1 #include 2 3 int Binar 阅读全文
posted @ 2013-08-10 10:31 芷水 阅读(418) 评论(0) 推荐(0) 编辑
摘要: Primitive RootsTime Limit:1000MSMemory Limit:10000KTotal Submissions:2479Accepted:1385DescriptionWe say that integer x, 0 10 11 12 int Euler(int n)13 {14 int i,temp=n;15 for(i=2;i*i0)33 {34 printf("%d\n",Euler(n-1));35 }36 return 0;37 } 阅读全文
posted @ 2013-08-10 09:25 芷水 阅读(271) 评论(0) 推荐(0) 编辑
摘要: S-NimTime Limit : 5000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 2Accepted Submission(s) : 1Problem DescriptionArthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows:The starting position has a number of hea 阅读全文
posted @ 2013-08-09 17:41 芷水 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Georgia and BobTime Limit:1000MSMemory Limit:10000KTotal Submissions:6622Accepted:1932DescriptionGeorgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..., and place N chessmen on different grids, as shown in the follo 阅读全文
posted @ 2013-08-09 16:30 芷水 阅读(258) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 33 下一页