結果

問題 No.106 素数が嫌い!2
ユーザー neko_the_shadowneko_the_shadow
提出日時 2024-02-07 11:29:50
言語 Bash
(Bash 5.1.16)
結果
TLE  
実行時間 -
コード長 394 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 6,932 KB
実行使用メモリ 305,768 KB
最終ジャッジ日時 2024-02-07 11:30:08
合計ジャッジ時間 16,578 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,069 ms
155,312 KB
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 AC 3,100 ms
155,312 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

awk '{
    N=$1
    K=$2

    for(i=0;i<=N;i++)is_prime[i]=1
    is_prime[0]=0
    is_prime[1]=0
    for(i=2;i*i<=N;i++){
        if(!is_prime[i])continue;
        for(j=i+i;j<=N;j+=i)is_prime[j]=0
    }

    for(i=2;i<=N;i++){
        if(!is_prime[i])continue;
        for(j=i;j<=N;j+=i)count[j]+=1;
    }

    sum=0
    for(i=2;i<=N;i++){
        if(count[i]>=K)sum+=1
    }
    print sum
}
'
0