結果

問題 No.36 素数が嫌い!
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-17 03:27:05
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 25,804 KB
実行使用メモリ 11,624 KB
最終ジャッジ日時 2023-09-22 16:53:23
合計ジャッジ時間 6,903 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
11,492 KB
testcase_01 WA -
testcase_02 AC 225 ms
11,484 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 220 ms
11,544 KB
testcase_06 AC 221 ms
11,612 KB
testcase_07 AC 221 ms
11,460 KB
testcase_08 AC 122 ms
11,484 KB
testcase_09 AC 121 ms
11,620 KB
testcase_10 AC 119 ms
11,484 KB
testcase_11 AC 224 ms
11,484 KB
testcase_12 AC 227 ms
11,580 KB
testcase_13 AC 224 ms
11,552 KB
testcase_14 WA -
testcase_15 AC 120 ms
11,424 KB
testcase_16 AC 223 ms
11,464 KB
testcase_17 AC 227 ms
11,548 KB
testcase_18 AC 118 ms
11,552 KB
testcase_19 AC 118 ms
11,548 KB
testcase_20 AC 127 ms
11,460 KB
testcase_21 AC 118 ms
11,460 KB
testcase_22 AC 119 ms
11,460 KB
testcase_23 AC 120 ms
11,532 KB
testcase_24 WA -
testcase_25 AC 122 ms
11,624 KB
testcase_26 AC 228 ms
11,488 KB
testcase_27 AC 225 ms
11,428 KB
testcase_28 AC 226 ms
11,624 KB
testcase_29 AC 219 ms
11,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <math.h>
#include <string.h>
#include <stdio.h>

char prime[10001000];

void getPrime(int p){
	int i,j;
	for(i=0;i<p;i++){
		prime[i] = 1;
		if((i&1) == 0){
			prime[i] = 0;
		}
	}
	
	prime[0]=0;
	prime[1]=1;
	prime[2]=1;
	
	for(i=3;i*i<=p;i+=2){
		for(j=i+i;j<=p;j+=i){
			prime[j]=0;
		}
	}
}

int main(void){
	long long int n;
	int i, p = 10000000 + 1;
	int yes=0;
	getPrime(p);
	
	scanf("%lld", &n);
	
	for(i=1;i<p;i++){
		if(n%i == 0){
			if(prime[i]==1){
				
			}else{
				yes = 1;
				break;
			}
		}
	}
	
	if(yes == 1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	
	return 0;
}
0