专属质数

嘿嘿嘿,出题人你再卡我?

\(2693\)

\(44533\)

\(309007\)

\(7710343\)

\(55426561\)

\(991664501\)

#include<cstdio>
#include<cstdlib>
#include<ctime>
#define int long long
bool cmp(int x)
{
	for(int i=2;i*i<=x;++i)
	{
		if(x%i==0)
		return false;
	}
	return true;
}
int count(int x)
{
	int k=0;
	while(x>0)
	{
		x/=10;
		++k;
	}
	return k;
}
signed main()
{
	srand(time(NULL));
	while(1)
	{
		int i=(rand()*rand())%(rand()*rand())+rand();
		if(cmp(i)==true&&count(i)==6)
		{
			printf("%lld\n",i);
			return 0;
		}
	}
	return 0;
}
posted @ 2018-11-02 09:58  Point_King  阅读(234)  评论(1)    收藏  举报