zoj 1284||poj 1528||hdu 1323(筛选法求因子和)
来源:互联网 发布:郑州云端网络科技学院 编辑:程序博客网 时间:2024/04/29 15:04
点击打开链接
如果一个数的因子和等于本身就是完美的。
不包括本身,所以,1的应该等于0
#include"stdio.h"#include"string.h"#include"algorithm"using namespace std;#define N 60001int A[N];int n;void init(){int i,j;A[0]=-1;for(i=1;i<N;i++)A[i]=1;A[1]=0;for(i=2;i<N;i++){for(j=2;j*i<N;j++)A[j*i]+=i;}}int main(){init();printf("PERFECTION OUTPUT\n");while(scanf("%d",&n)!=-1){if(n==0){printf("END OF OUTPUT\n");break;}if(A[n]==n)printf("%5d PERFECT\n",n);else if(A[n]<n)printf("%5d DEFICIENT\n",n);else printf("%5d ABUNDANT\n",n);}return 0;}
- zoj 1284||poj 1528||hdu 1323(筛选法求因子和)
- zoj 2286(因子和,筛选法)
- HDU 1299 素数筛选+求因子个数
- ZOJ 1978 && HDU 1216 && POJ 2552 Assistance Required (筛选)
- ZOJ 2095 Divisor Summation (求因子和)
- ZOJ 1284 Perfection (因子和)
- 筛选求数字不包括自身的因子和
- HDU 七夕节(求一个数的因子和)
- hdu oj 2136 Largest prime factor 和 nyoj 520 最大素因子 【筛选法】
- 筛选法-因子之和
- POJ 2262 Goldbach's Conjecture ( 筛选法求素数 )
- HDU 1695(数论,筛选+素因子分解+容斥)
- HDU 1695(数论,筛选+素因子分解+容斥)
- poj 2992 Divisors(求因子个数)
- HDU 2136 Largest prime factor (筛选法求素数)
- HDU 3864 D_num (求因子个数)
- HDU 6069 Counting Divisors(求因子)
- poj 1845 (因子和)
- (hdu2612)
- hdu1503(DP)
- UVa:615 Is It A Tree?
- 虚拟机启动报错Unable to open kernel device "\\.\VMCIDev\VMX"
- Linux LCD驅動架構學習(二)
- zoj 1284||poj 1528||hdu 1323(筛选法求因子和)
- Dijkstra算法模板
- 深度缓冲区原理以及为什么要用它
- BNU The Twin Towers
- 二叉树遍历,已知前序遍历与中序遍历,求后续遍历 使用java(递归方式)实现
- jquery 获得keycode
- Linux基本操作 4----- Linux系统目录架构
- 网络
- 白书的一些题目