結果

問題 No.36 素数が嫌い!
ユーザー BantakoBantako
提出日時 2017-07-13 18:54:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 699 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 40,524 KB
最終ジャッジ日時 2024-04-16 18:36:58
合計ジャッジ時間 6,586 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 183 ms
40,396 KB
testcase_02 AC 162 ms
40,360 KB
testcase_03 AC 167 ms
40,424 KB
testcase_04 AC 170 ms
40,476 KB
testcase_05 AC 193 ms
40,396 KB
testcase_06 AC 162 ms
40,336 KB
testcase_07 AC 182 ms
40,404 KB
testcase_08 AC 160 ms
40,332 KB
testcase_09 AC 161 ms
40,356 KB
testcase_10 AC 175 ms
40,372 KB
testcase_11 AC 176 ms
40,424 KB
testcase_12 AC 178 ms
40,420 KB
testcase_13 AC 208 ms
40,408 KB
testcase_14 AC 153 ms
40,348 KB
testcase_15 AC 157 ms
40,380 KB
testcase_16 AC 164 ms
40,336 KB
testcase_17 AC 160 ms
40,464 KB
testcase_18 AC 158 ms
40,352 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 162 ms
40,360 KB
testcase_25 WA -
testcase_26 AC 174 ms
40,452 KB
testcase_27 AC 174 ms
40,384 KB
testcase_28 AC 176 ms
40,404 KB
testcase_29 AC 184 ms
40,236 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |     scanf("%lld",&N);
      |     ~~~~~^~~~~~~~~~~

ソースコード

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){break;}
    }
    printf("%s\n",count>=3?"YES":"NO");
}
0