2013年7月19日

POJ2478 - Farey Sequence(法雷级数&&欧拉函数)

摘要: 题目大意 直接看原文吧。。。。 The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 #include#include#include#define MAXN 1000005using namespace std;int phi[MAXN],... 阅读全文

posted @ 2013-07-19 16:26 仗剑奔走天涯 阅读(221) 评论(0) 推荐(0) 编辑

POJ2407–Relatives(欧拉函数)

摘要: 题目大意 给定一个正整数n,要求你求出所有小于n的正整数当中与n互质的数的个数 题解 欧拉函数模板题~~~因为n过大~~~所以直接用公式求 代码: #include#include#includeusing namespace std;int euler_phi(int n){ int m=(int)sqrt(n+0.5); int ans=n; for(int i=2; i1)... 阅读全文

posted @ 2013-07-19 15:58 仗剑奔走天涯 阅读(227) 评论(0) 推荐(0) 编辑

导航