3 2 5 8
yes yes no
#include <iostream>
using namespace std;
int main (void)
{
int n,m,i,j,k,l;
int s[500005]={0},ss[1111]={0};
for(i=1;i<250005;i++)
for(j=i+i;j<500005;j+=i)
s[j]+=i;
for(i=0;i<500005;i++)
if(s[i]<1001)ss[s[i]]=1;
cin>>m;
while(m--&&cin>>n)
{
if(ss[n]==0)cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}
原文:http://blog.csdn.net/jingdianitnan/article/details/37827265