UVA 10820(p322)----Send a Table
来源:互联网 发布:凯立德导航端口查询 编辑:程序博客网 时间:2024/06/07 01:51
#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int N=50000;int phi[N+50],x;long long ans;void init(){ memset(phi,0,sizeof(phi)); phi[1]=1; for(int i=2; i<=N; i++) if(!phi[i]) for(int j=i; j<=N; j+=i) { if(!phi[j]) phi[j]=j; phi[j]=phi[j]/i*(i-1); }}int main(){ init(); while(scanf("%d",&x)==1&&x) { //cout<<x<<endl; if(x==1)printf("1\n"); else { ans=1; for(int i=2;i<=x;i++) { // cout<<i<<endl; ans+=2*phi[i]; // cout<<phi[x]<<endl; } printf("%lld\n",ans); } } return 0;}
0 0
- UVA 10820(p322)----Send a Table
- UVA 10820 Send a Table
- uva 10820 - Send a Table
- UVA - 10820 Send a Table
- UVa:10820 Send a Table
- UVA 10820 - Send a Table
- UVA 10820 Send a Table
- UVa 10820 - Send a Table
- UVA - 10820 Send a Table
- UVA 10820 Send a Table
- uva 10820 Send a Table
- UVA - 10820 - Send a Table
- UVA 10820 Send a Table
- UVa 10820 Send a Table
- UVa 10820 Send a Table
- UVA 10820 Send a Table
- Send a Table UVA
- Send a Table UVA
- LeetCode 12. Integer to Roman & 13. Roman to Integer
- spirngMVC+Hibernate+SpringSecuirty+Extjs一个简单的权限管理系统
- UVA 10801(p381)----Lift Hopping
- gulp改造gulp-rev-append插件实现资源文件链接自动添加MD5版本号
- XAMPPS1.8.5工具单独升级php版本(5.2升级到5.4.45)
- UVA 10820(p322)----Send a Table
- HashMap的介绍和基本使用方法
- bootstrap Snippets使用方法
- hello CSDN
- PID控制相关在线教程
- Python学习笔记(四) 多重继承及内部算法解析
- 数据结构算法之排序系列Java、C源码实现(2)--希尔排序
- UVA 10837(p345)----A Research Problem
- HashMap的使用,简单小代码