結果

問題 No.36 素数が嫌い!
ユーザー dnishdnish
提出日時 2017-07-04 21:10:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 444 bytes
コンパイル時間 1,537 ms
コンパイル使用メモリ 161,912 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-04-15 16:14:26
合計ジャッジ時間 3,733 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
7,936 KB
testcase_01 AC 69 ms
11,008 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 59 ms
6,784 KB
testcase_12 AC 210 ms
12,800 KB
testcase_13 WA -
testcase_14 AC 47 ms
9,600 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 28 ms
7,296 KB
testcase_20 AC 100 ms
12,952 KB
testcase_21 AC 67 ms
10,752 KB
testcase_22 AC 70 ms
11,136 KB
testcase_23 AC 35 ms
8,064 KB
testcase_24 AC 39 ms
8,576 KB
testcase_25 AC 38 ms
8,576 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;

bool isprime[10000010];
ll N;
void prime(){
	isprime[0]=isprime[1]=true;
	for(ll i=2;i*i<=N;i++){
		if(isprime[i]) continue;
		for(ll j=i;j*j<=N;j+=i){
			isprime[j]=true;
		}
	}
}

int main(){
	cin>>N;
	prime();
	bool flag=false;
	for(ll i=2;i*i<=N;i++){
		if(N%i==0&&isprime[i]){
			flag=true;
			break;
		}
	}
	p(flag?"YES":"NO");
	return 0;
}
0