poj3090
来源:互联网 发布:python 量化分析 编辑:程序博客网 时间:2024/06/05 03:01
#include<iostream>#include<cmath>#include<cstdio>#include<cstdlib>//#define LL long longtypedef long long LL;using namespace std;int phi[1005];void enlerPhi(){memset(phi,0,sizeof(phi)); for (int i = 2 ; i <= 1003 ; i ++ ){ if( !phi[i] ){ for(int j = i ; j <= 1003 ; j += i){ if (!phi[j]){phi [j ] = j ;} //标记合数 等于一个数 phi [j] = phi [j] / i * ( i - 1 ) ; } } }}int work(int x){ int sum=0; for(int i=2;i<=x;i++){ sum=sum+phi[i]; } sum=sum*2+3; return sum; }int main(){enlerPhi(); int n,x; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&x); printf("%d %d %d\n",i,x,work(x)); }return 0;}
0 0
- poj3090
- POJ3090
- POJ3090
- poj3090(eular)
- poj3090-Visible Lattice Points
- poj3090-Visible Lattice Points
- [POJ3090]欧拉公式
- [POJ3090] 可见点
- poj3090 Visible Lattice Points
- [POJ3090]Visible Lattice Points
- POJ3090 Visible Lattice Points
- Visible Lattice Points(poj3090)
- Visible Lattice Points(POJ3090)
- poj3090(欧拉函数)
- POJ3090-Visible Lattice Points-数论
- poj3090 欧拉函数打表
- poj3090 Visible Lattice Points 欧拉函数的应用
- poj3090 Visible Lattice Points(莫比乌斯反演)
- 在spring的bean中注入内部类
- 关于错误的那点事——惨不忍睹的错误
- 2 类与对象
- NRF51822自学笔记(二)PWM
- android笔记
- poj3090
- 基于vitamio5.0的android播放器
- poj1995
- 设计模式(6)--Bridge 桥接模式
- ScrollView里面的EditText的点击空白处键盘消失的问题
- SSZipArchive使用详解
- 解决ntp的错误 no server suitable for synchronization found
- 一个简单可以设定时间的数据缓存库 (附 源码)
- 关于自定义view时的getDimension的三种写法