結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
11,428 KB
testcase_01 WA -
testcase_02 AC 120 ms
11,544 KB
testcase_03 AC 119 ms
11,460 KB
testcase_04 AC 121 ms
11,532 KB
testcase_05 AC 228 ms
11,480 KB
testcase_06 AC 229 ms
11,484 KB
testcase_07 AC 228 ms
11,532 KB
testcase_08 AC 123 ms
11,544 KB
testcase_09 AC 126 ms
11,528 KB
testcase_10 AC 122 ms
11,624 KB
testcase_11 AC 230 ms
11,528 KB
testcase_12 AC 232 ms
11,536 KB
testcase_13 AC 231 ms
11,616 KB
testcase_14 AC 123 ms
11,456 KB
testcase_15 AC 123 ms
11,616 KB
testcase_16 AC 125 ms
11,532 KB
testcase_17 AC 125 ms
11,536 KB
testcase_18 AC 124 ms
11,432 KB
testcase_19 AC 124 ms
11,464 KB
testcase_20 AC 135 ms
11,620 KB
testcase_21 AC 126 ms
11,424 KB
testcase_22 AC 127 ms
11,456 KB
testcase_23 AC 121 ms
11,552 KB
testcase_24 WA -
testcase_25 AC 122 ms
11,536 KB
testcase_26 AC 227 ms
11,624 KB
testcase_27 AC 232 ms
11,548 KB
testcase_28 AC 229 ms
11,488 KB
testcase_29 AC 227 ms
11,536 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,tmp;
    int i, p = 10000000 + 1;
    int yes=0;
    getPrime(p);
    
    scanf("%lld", &n);
    
    for(i=2;(i<n && i<=p);i++){
        if(n%i == 0){
            if(prime[i]==1){
                
				int cnt=0;
				tmp = n;
				while(tmp%i == 0){
					tmp/=i;
					cnt++;
				}
				if(cnt>2){
					yes=1;
					break;
				}
            }else{
                yes = 1;
                break;
            }
        }
    }
    
    if(yes == 1){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    
    return 0;
}
0