![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
ren_hui
每天早上醒来你荷包里的最大资产是24个小时你生命宇宙中尚未制造的材料
展开
-
poj_1006 Biorhythms
题目链接:http://poj.org/problem?id=1006 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 101167 Accepted: 31195 Description Some people believe that there are t原创 2013-05-22 19:12:25 · 401 阅读 · 0 评论 -
poj 2407 Relatives
题目链接:http://poj.org/problem?id=2407 解题思路: φ函数的值 Euler函数 通式:φ(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…..(1-1/pn) 其中p1, p2……pn为x的所有质因数,x是不为0的整数 φ(1)=1(唯一和1互质的数就是1本身)【注意:每种质因数只一个。比如12=2*2*3】原创 2013-05-24 20:39:34 · 495 阅读 · 0 评论 -
Factorial
Factorial Time Limit: 1500MS Memory Limit: 65536K Total Submissions: 12996 Accepted: 8078 Description The most important part of a GSM network is so called Base Transce原创 2013-05-26 19:30:11 · 408 阅读 · 0 评论 -
欧几里德与扩展欧几里德算法
欧几里德算法 欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。 基本算法:设a=qb+r,其中a,b,q,r都是整数,则gcd(a,b)=gcd(b,r),即gcd(a,b)=gcd(b,a%b)。 第一种证明: a可以表示成a = kb + r,则r = a mod b 假设d是a,b的一个公约数,则有 d|a, d|b,而r = a - kb,因转载 2013-05-28 19:44:30 · 448 阅读 · 0 评论 -
hdu_1012
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1012 代码: #include int a[10]; double b[10]; void fun() { a[0]=1; for(int i=1;i<=9;i++) a[i]=a[i-1]*i; } int main() { fun(); printf("n e\n"); printf原创 2013-06-02 20:29:27 · 474 阅读 · 0 评论 -
hdu 1014
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1014 代码: #include #include #define N 100005 int Time[N],step,num[N],mod; int flag=1; int main() { while(scanf("%d%d",&step,&mod)!=EOF) { memset(Ti原创 2013-06-02 21:54:37 · 537 阅读 · 0 评论 -
hdu 1019
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1019 代码: /* 最小公倍数的时候 a*b/c a*b可能会溢出 应该写成:a/c*b */ #include int a[10000]; int gcd(int m,int n) { if(n==0) return m; else return gcd(n,m%n); }原创 2013-06-03 19:39:30 · 902 阅读 · 0 评论 -
hdu 1021
链接: 解题思路: 1.7%3=1 2.11%3=2 3.(11+7)%3=(1+2)%3=0 4.(2+0)%3=2 5.(0+2)%3=2 6.(2+2)%3=1 7.(2+1)%3=0 8.(1+0)%3=1 9.(0+1)%3=1 10。(1+1)%3=2; 是有循环节的。。。 代码: #include int main() { int N; whil原创 2013-06-05 21:55:37 · 329 阅读 · 0 评论