上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 33 下一页
摘要: Happy 2006Time Limit:3000MSMemory Limit:65536KTotal Submissions:8359Accepted:2737DescriptionTwo positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD) is 1. For instance, 1, 3, 5, 7, 9...are all relatively prime to 2006.Now your job is easy: for the given i 阅读全文
posted @ 2013-08-09 11:33 芷水 阅读(280) 评论(0) 推荐(0) 编辑
摘要: Longge's problemTime Limit:1000MSMemory Limit:65536KTotal Submissions:6383Accepted:2043DescriptionLongge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some graceful algorithms. Now a problem comes: Given an integer N(1 20 #include21 #includ 阅读全文
posted @ 2013-08-09 09:51 芷水 阅读(1423) 评论(0) 推荐(1) 编辑
摘要: GCDTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4141Accepted Submission(s): 1441Problem Descrip... 阅读全文
posted @ 2013-08-08 20:03 芷水 阅读(406) 评论(0) 推荐(0) 编辑
摘要: Co-primeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 935Accepted Submission(s): 339Problem DescriptionGiven a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N.Two integers are said 阅读全文
posted @ 2013-08-08 17:00 芷水 阅读(399) 评论(0) 推荐(0) 编辑
摘要: NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2159Accepted Submission(s): 614Problem Description Here are two numbers A and B (0 x : ans 1-1:0 1-2:0 1-3:0 1-4:0 1-5:0//x小于等于5之前都是0。5/2-2 = 0 1-6:1//x是某个数的平方和,且k为偶数。则不变 6/2-2 = 1; 1-7:1//x是某个. 阅读全文
posted @ 2013-08-08 10:20 芷水 阅读(244) 评论(0) 推荐(0) 编辑
摘要: GCDTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 812Accepted Submission(s): 363Problem DescriptionThe greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,( 阅读全文
posted @ 2013-08-08 09:31 芷水 阅读(255) 评论(0) 推荐(0) 编辑
摘要: Calculation 2Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1750Accepted Submission(s): 727Problem DescriptionGiven a positive integer N, your task is to calculate the sum of the positive integers less than N which are not coprime to N. A is said 阅读全文
posted @ 2013-08-07 18:21 芷水 阅读(271) 评论(0) 推荐(0) 编辑
摘要: The Euler functionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2986Accepted Submission(s): 1221Problem DescriptionThe Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smalle 阅读全文
posted @ 2013-08-07 17:11 芷水 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 欧拉函数:一个整数n,小于且和n互质的正整数的个数(包含1)的个数,用φ(n)表示。完全余数集合:欧拉函数中与n互质的数字的集合.~~~~~~~~~~~~~~性质:如果n是素数,则 φ(n)=n-1;求一个数n的所有互素和 sum=φ(n)*n/2; <==这个性质,很有用。欧拉定理:对于互质的正整数a和n,有aφ(n)≡1modn。费马定理:若正整数a与素数p互质,则有ap-1≡1modp。证明这个定理非常简单,由于φ(p)=p-1,代入欧拉定理即可证明。~~~~~~~~~~~~~~~~~~~~~~补充欧拉公式:1.pk的欧拉函数对于给定的一个素数p,φ(p)=p-1。则对于正整数n= 阅读全文
posted @ 2013-08-07 10:57 芷水 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 素数打表,总结了两种形式。一种是传统的在一个数组里进行标记,进行判断。一种是直接将素数放进一个数组里。 1 #include 2 #include 3 #include 4 5 6 int prime[1000003],size=0; 7 int s[1000003]; 8 9 void make_ini() //素数打表。直接装在一个数组里面10 {11 int i,j;12 memset(s,0,sizeof(s));13 for(i=2;i<=1000000;i++)14 {15 if(s[i]==0)16 {17 ... 阅读全文
posted @ 2013-08-07 10:22 芷水 阅读(198) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 33 下一页