poj 2407 Relatives(欧拉函数模板题)
来源:互联网 发布:配电网设计软件 编辑:程序博客网 时间:2024/05/22 15:51
题意:就是求小于n且与n互质的数的个数。
思路:欧拉函数模板题。
#include <iostream>using namespace std;int Euler(int n){ int res = n,i; for(i=2; i * i <= n; i++) if(n%i == 0) { n /=i ; res = res - res/i; while(n % i ==0) n/=i; } if (n > 1) res = res - res/n; return res;}int main(){ int n; while(cin>>n) { if(n==0) break; if(n==1) cout<<"0"<<endl; else cout<<Euler(n)<<endl; } return 0;}
0 0
- poj 2407 Relatives(欧拉函数模板题)
- POJ-2407-Relatives(欧拉函数模板题)
- poj 2407 Relatives(欧拉函数模板)
- 欧拉函数 模板题 POJ2407 Relatives
- POJ 2407 Relatives && UVA 10299 Relatives(欧拉函数)
- POJ 2407 Relatives 欧拉函数
- POJ 2407 Relatives 欧拉函数
- poj 2407 Relatives(欧拉函数)
- POJ 2407 Relatives 欧拉函数题解
- poj 2407Relatives(数论:欧拉函数)
- [POJ 2407]Relatives(欧拉函数)
- POJ 2407 Relatives (欧拉函数)
- POJ 2407 : Relatives - 欧拉函数
- POJ 2407 Relatives(欧拉函数)
- POJ 2407 Relatives(欧拉函数)
- POJ 2407 Relatives(欧拉函数)
- POJ-2407-Relatives-欧拉函数
- POJ 2407 Relatives (欧拉函数)
- Python面向对象学习(2)
- 0018-【EasyUI】combotree和combobox模糊查询
- SDWebimage框架解析
- Android Context相关总结
- FM切为扬声器模式,耳机和扬声器同时有声音-
- poj 2407 Relatives(欧拉函数模板题)
- Windows上使用VIM入门之文件操作
- IOS自带处理缓存方法
- 了解Lua语言中的_index,newindex,rawget和rawset
- 纯代码创建控制器
- 每天进步一点点——五分钟理解一致性哈希算法(consistent hashing)
- iOS 核心动画 书籍
- explain中的key_len
- Android总结02_Touch事件的分发与消费机制