結果

問題 No.36 素数が嫌い!
ユーザー myanta
提出日時 2017-05-01 01:59:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 23,424 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 01:05:11
合計ジャッジ時間 1,230 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>


typedef long long ll;


int solve(ll x)
{
	ll i;
	int c=0;

	for(;x%2==0;x/=2)
	{
		c++;
		if(c>=3) return 1;
	}

	for(i=3;i*i<=x;i+=2)
	{
		for(;x%i==0;x/=i)
		{
			c++;
			if(c>=3) return 1;
		}
	}
	if(x>1) c++;

	return c>=3;
}


int main(void)
{
	ll n;

	while(scanf("%lld", &n)==1)
	{
		printf("%s\n", solve(n)?"YES":"NO");
	}

	return 0;
}
0