现在的位置: 首页 > 综合 > 正文

hdu 1999

2018年12月30日 ⁄ 综合 ⁄ 共 400字 ⁄ 字号 评论关闭

数据有问题,s(8)=7,s(28)=28,

如果这两个数是不可摸数的程序也ac

直接暴力打表

#include<stdio.h>
#include<string.h>
#include<math.h>
int mark[1002];
int main()
{
	int i,j,k,t,n,temp;
	memset(mark,0,sizeof(mark));
	for(i=2;i<500000;i++)
	{
	      temp=1;
		for(j=2;j*j<=i&&temp<=1000;j++)
		{
			if(i%j!=0)continue;
			  temp+=j;
			  if(j!=i/j)
				  temp+=i/j;
		}
		if(temp<=1000)
			mark[temp]=1;
	}
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		if(mark[n])printf("no\n");
		else printf("yes\n");
	}
	return 0;
}
【上篇】
【下篇】

抱歉!评论已关闭.