結果

問題 No.106 素数が嫌い!2
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-11 01:56:25
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,458 ms / 5,000 ms
コード長 277 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 6,600 KB
実行使用メモリ 21,672 KB
最終ジャッジ日時 2023-09-06 23:14:07
合計ジャッジ時間 10,141 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
13,708 KB
testcase_01 AC 12 ms
6,048 KB
testcase_02 AC 13 ms
5,952 KB
testcase_03 AC 11 ms
6,136 KB
testcase_04 AC 764 ms
13,532 KB
testcase_05 AC 1,429 ms
21,612 KB
testcase_06 AC 1,442 ms
21,612 KB
testcase_07 AC 1,453 ms
21,528 KB
testcase_08 AC 93 ms
6,812 KB
testcase_09 AC 91 ms
7,136 KB
testcase_10 AC 1,431 ms
21,672 KB
testcase_11 AC 609 ms
12,872 KB
testcase_12 AC 1,458 ms
20,840 KB
testcase_13 AC 11 ms
5,988 KB
testcase_14 AC 12 ms
6,048 KB
testcase_15 AC 12 ms
5,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,raw_input().split())
isPrime=[0 for i in xrange(N+1)]
ans=0
if K==1:
    print N-1
    exit()
for i in xrange(2,N+1):
    if isPrime[i]==0:
        for j in xrange(i+i,N+1,i):
            isPrime[j]+=1
            if isPrime[j]==K:
                ans+=1
print ans
0