0
点赞
收藏
分享

微信扫一扫

HDU 1999 不可摸数 (约数和。。)


不可摸数

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 11521    Accepted Submission(s): 3000

Problem Description

s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何
数m,s(m)都不等于n,则称n为不可摸数.



Input

包含多组数据,首先输入T,表示有T组数据.每组数据1行给出n(2<=n<=1000)是整数。


Output

如果n是不可摸数,输出yes,否则输出no



Sample Input


3
2
5
8



Sample Output


yes
yes
no



Author

Zhousc@ECJTU

Source

​​ECJTU 2008 Spring Contest ​​



Recommend

lcy   |   We have carefully selected several similar problems for you:  ​​1996​​​ ​​1998​​​ ​​1995​​​ ​​1695​​​ ​​1215​​ 


题意:一个数 n与任何数的因子和都不相等,那么n就叫做不可摸数。判断这个数n是否不可摸数。




 AC代码:打表


#include<iostream>
#include <stdio.h>
using namespace std;
#define N 500010
__int64 a[N];
int ans[1010];
//一个数 n与任何数的因子和都不相等,那么n就叫做不可摸数
void init ()
{
for (int i=1; i<N/2; ++i)
for ( int j=i*2; j<N; j+=i)
a[j] += i;

for (int i=0; i<N; i++)
if (a[i]<=1000)
ans[a[i]] = 1;
}
int main ()
{
int n, i, t;
scanf ("%d", &t);
init();
while (t --)
{
scanf ("%d", &n);
if (ans[n])
printf ("no\n");
else
printf ("yes\n");
}
return 0;
}



举报

相关推荐

0 条评论