Farey SequenceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12802Accepted: 4998DescriptionThe Farey Sequence Fn for any integer n with n >=...
分类:
其他好文 时间:
2015-05-03 21:54:32
阅读次数:
120
题目链接: http://poj.org/problem?id=2478题目大意: 在一个集合f(n)中,包涵一些分数a/b,这些分数满足: 1:不可约分。 2:0 2 #include 3 #include 4 #include 5 #include 6 using namesp...
分类:
其他好文 时间:
2015-04-23 19:21:18
阅读次数:
156
Farey Sequence
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice POJ
2478
Appoint description:
System Crawler (2015-04-01)
Descript...
分类:
其他好文 时间:
2015-04-09 09:00:19
阅读次数:
157
题目大意:求一个n的farey序列思路:懒得麻烦的推导和公式了,暴力压倒一切/*{ID:a4298442PROB:frac1LANG:C++}*/#include#include#include#include#define maxn 160*160+10using namespace std;if...
分类:
其他好文 时间:
2015-03-06 23:35:50
阅读次数:
127
#include #include using namespace std;#define CLR( a, b ) memset( a, b, sizeof(a) )#define MAXN 1010int phi[ MAXN ], farey[ MAXN ], n, t;void get_eul....
分类:
其他好文 时间:
2014-11-04 18:49:58
阅读次数:
203
POJ 2478 Farey Sequence ( 欧拉函数 + 法雷数列 )#include #include using namespace std;#define MAXN 1000005typedef long long LL;int vis[ MAXN ], prime[ MAXN ],....
分类:
其他好文 时间:
2014-11-04 16:44:16
阅读次数:
197
POJ2478_Farey Sequence【快速求欧拉函数】
题目大意:
给你一个数n,对于0 < a < b <= n,求真分数a/b的个数
思路:因为a/b为真分数,所以a和b互质。
求真分数a/b的个数。其实就是求0 < i <= n中,小于i的正整数中,
有多少个与i互质的数。累加起来就是真分数a/b的个数。
其实就是欧拉函数
因为n的规模为10^6,可用快速求欧拉函数的方法求得(类似于筛法求素数)。
根据推论:设P是素数,
若p是x的约数,则E(x*p)=E(x)*p.
若p不是x的约数...
分类:
其他好文 时间:
2014-10-15 23:10:51
阅读次数:
178
http://poj.org/problem?id=2478http://acm.hdu.edu.cn/showproblem.php?pid=2824欧拉函数模板裸题,有两种方法求出所有的欧拉函数,一是筛法,而是白书上的筛法。首先看欧拉函数的性质:欧拉函数是求小于n且和n互质(包括1)的正整数的个...
分类:
其他好文 时间:
2014-10-03 20:11:05
阅读次数:
226
Farey SequenceTime Limit:1000MSMemory Limit:65536KDescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational nu...
分类:
其他好文 时间:
2014-07-24 22:53:03
阅读次数:
211
DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b) = 1 arr...
分类:
其他好文 时间:
2014-07-22 00:20:35
阅读次数:
283