不可估摸数(好题)

[题目](https://vjudge.net/contest/357311#problem/G)
#include<iostream>
using namespace std;
const	int N=500000;
int s[N];
bool b[N];
void init()
{
   
	for(int j=1;j<=N;j++) //这种筛法复杂度nlogn
	for(int i=j+j;i<=N;i+=j)
		s[i]+=j;
		for(int j=1;j<=N;j++) 
		if(s[j]&&s[j]<=1000)
		b[s[j]]=1; 		

}
int main()
{
   
	init();
	int t;
	cin>>t;
	while(t--)
	{
   
		int n;
		cin>>n;
		if(b[n]==1)
		cout<<"no"<<endl;
		else
		cout<<"yes"<<endl;
		
	}
	return 0;	
}
全部评论

相关推荐

码农索隆:邮件那么小的内存,把邮箱都干满了
点赞 评论 收藏
分享
牛客吹哨人:哨哥晚点统一更新到黑名单:能救一个是一个!26届毁意向毁约裁员黑名单https://www.nowcoder.com/discuss/1525833
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务