- 博客(17)
- 资源 (2)
- 收藏
- 关注
原创 丑数总结
丑数说丑数前先说几个定义。正整数N的因子(factor):小于N且能整除N的整数。如:12的因子为1,2,3,4,6.正整数N的质因子(prime factor):能整除N的质数。如:12的质因子为2,3.正整数N的因数:能整除N的数(包括N)。如:12的因子为1,2,3,4,6,12.丑数的定义:质因子只可能包含2,3,5的正整数,规定1为第一个丑数。算法实现:1.根
2014-11-30 23:57:43 6356
原创 nyoj 题目570 欧拉函数求和
http://acm.nyist.net/JudgeOnline/problem.php?pid=570#includeint Euler(int n){ int ret=n,i; for(i=2;i*i<=n;i++) { if(n%i==0) { ret=ret-ret/i; while(n%i==0) n/=i;
2014-11-23 17:55:29 648
原创 各种方法判断素数所用时的间比较
一.用朴素法判断素数与用欧拉函数判断素数的时间比较Ps:如果N是素数,则有Euler(N)+1=N.代码如下:#include#include#include#define MAX 10000000int Euler(int n){//欧拉函数 int ret=n,i;for(i=2;i*iif(n%i==0){ret=ret-r
2014-11-22 23:34:39 784
原创 hdoj 2824 The Euler function(欧拉函数打表)
http://acm.hdu.edu.cn/showproblem.php?pid=2824
2014-11-22 16:55:00 884
原创 hdoj 2588 GCD(欧拉函数)
http://acm.hdu.edu.cn/showproblem.php?pid=2588GCDTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1111 Accepted Submission(s): 507
2014-11-22 16:42:32 623
原创 hdoj 3501 Calculation 2(欧拉函数)
http://acm.hdu.edu.cn/showproblem.php?pid=3501#include#include#define NUM 1000000007__int64 Euler(__int64 n){__int64 ret=n,i;for(i=2;i*i1) ret=ret-ret/n;return ret;}int main(){__int64 N,sum_
2014-11-22 08:07:28 673
原创 hdoj 1286 找新朋友(欧拉函数)
http://acm.hdu.edu.cn/showproblem.php?pid=1286#include#includeint a[33000];int main(){ int T,N,i,j,k,n,m; scanf("%d",&T); while(T--) { int sum=0;
2014-11-21 23:59:19 683
原创 欧拉函数
http://pan.baidu.com/s/1ntOaEId欧拉函数 主讲人 厉伟键欧拉函数对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。此函数以其首名研究者欧拉命名,它又称为φ函数、欧拉商数等。 例如φ(8)=4,因为1,3,5,7均和8互质。φ函数通式:φ(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…..(1-1/
2014-11-21 23:41:10 457
原创 hdoj 1787 GCD Again(欧拉函数)
http://acm.hdu.edu.cn/showproblem.php?pid=1787
2014-11-21 23:33:33 598
原创 HDU 1312 Red and Black (分别用并查集和DFS实现)
http://acm.hdu.edu.cn/showproblem.php?pid=1312
2014-11-16 09:07:14 558
原创 hdoj 5018 Revenge of Fibonacci
http://acm.hdu.edu.cn/showproblem.php?pid=5018#include#include#define MAX 1000000000__int64 a,b,C,c;int main(){ int N,i,j,k,J; scanf("%d",&N); while(N--) { scanf("%I64d %I
2014-11-06 18:44:09 561
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人