hdu 1999

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1999

题意:中文。

mark:打表到100w。。。(上限是试出来的。。。)

代码:

# include <stdio.h>


int sum[1000010] ;
int dp[1010] ;


void init()
{
int i, j ;
for (i = 1 ; i <= 500000 ; i++)
for (j = 2*i ; j <= 1000000 ; j+= i)
sum[j] += i ;
for (i = 2 ; i <= 1000000 ; i++)
if (sum[i] <= 1000) dp[sum[i]] = 1 ;
// for (i = 2 ; i < 1000 ; i++)
// if (dp[i] == 0) printf ("%4d", i) ;
}


int main()
{
int T, n ;
init() ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%d", &n) ;
puts (dp[n] ? "no" : "yes") ;
}
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2322086.html