結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
11,536 KB
testcase_01 WA -
testcase_02 AC 219 ms
11,584 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 218 ms
11,624 KB
testcase_06 AC 218 ms
11,464 KB
testcase_07 AC 218 ms
11,512 KB
testcase_08 AC 116 ms
11,572 KB
testcase_09 AC 117 ms
11,516 KB
testcase_10 AC 115 ms
11,536 KB
testcase_11 AC 220 ms
11,448 KB
testcase_12 AC 218 ms
11,512 KB
testcase_13 AC 219 ms
11,536 KB
testcase_14 AC 117 ms
11,404 KB
testcase_15 AC 116 ms
11,600 KB
testcase_16 AC 217 ms
11,572 KB
testcase_17 AC 217 ms
11,512 KB
testcase_18 AC 115 ms
11,428 KB
testcase_19 AC 116 ms
11,520 KB
testcase_20 AC 124 ms
11,580 KB
testcase_21 AC 115 ms
11,392 KB
testcase_22 AC 115 ms
11,508 KB
testcase_23 AC 114 ms
11,452 KB
testcase_24 WA -
testcase_25 AC 117 ms
11,512 KB
testcase_26 AC 220 ms
11,576 KB
testcase_27 AC 222 ms
11,484 KB
testcase_28 AC 221 ms
11,596 KB
testcase_29 AC 223 ms
11,512 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<=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