結果

問題 No.36 素数が嫌い!
ユーザー BantakoBantako
提出日時 2017-07-13 19:00:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 213 ms / 5,000 ms
コード長 742 bytes
コンパイル時間 1,187 ms
コンパイル使用メモリ 25,656 KB
実行使用メモリ 42,028 KB
最終ジャッジ日時 2023-09-09 08:04:24
合計ジャッジ時間 7,182 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
41,972 KB
testcase_01 AC 187 ms
41,996 KB
testcase_02 AC 181 ms
41,968 KB
testcase_03 AC 177 ms
41,980 KB
testcase_04 AC 171 ms
41,964 KB
testcase_05 AC 188 ms
41,996 KB
testcase_06 AC 156 ms
41,908 KB
testcase_07 AC 195 ms
42,028 KB
testcase_08 AC 167 ms
41,952 KB
testcase_09 AC 177 ms
41,984 KB
testcase_10 AC 196 ms
41,952 KB
testcase_11 AC 184 ms
41,988 KB
testcase_12 AC 186 ms
42,004 KB
testcase_13 AC 213 ms
41,908 KB
testcase_14 AC 166 ms
41,948 KB
testcase_15 AC 158 ms
41,932 KB
testcase_16 AC 168 ms
41,904 KB
testcase_17 AC 169 ms
41,996 KB
testcase_18 AC 176 ms
42,024 KB
testcase_19 AC 186 ms
41,988 KB
testcase_20 AC 185 ms
41,900 KB
testcase_21 AC 197 ms
42,024 KB
testcase_22 AC 186 ms
41,972 KB
testcase_23 AC 189 ms
41,968 KB
testcase_24 AC 183 ms
41,968 KB
testcase_25 AC 198 ms
41,972 KB
testcase_26 AC 187 ms
41,912 KB
testcase_27 AC 189 ms
41,988 KB
testcase_28 AC 194 ms
41,904 KB
testcase_29 AC 195 ms
42,016 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include<stdio.h>
int prime[10000001];//素数なら0
main(){
    //素数列を作成
    prime[0] = 1;//0,1は素数ではない
    prime[1] = 1;
    for(int i = 2;i*i <= 10000001;i++){
        if(!prime[i]){
            for(int j = i*2;j <= 10000001;j+=i){
                prime[j] = 1;
            }
        }
    }
    long long N;
    int count = 0;
    scanf("%lld",&N);
    while(N!=1){
        long long flag = N;
        for(int i = 2;i <= 10000000;i++){
            if(prime[i]){continue;}
            if(N%i==0){
                N /= i;
                count++;
                break;
            }
        }
        if(flag == N){
            count++;
            break;
        }
    }
    printf("%s\n",count>=3?"YES":"NO");
}
0