結果

問題 No.3079 アルベド
ユーザー 👑 rin204rin204
提出日時 2021-08-29 16:44:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 242 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 78,208 KB
最終ジャッジ日時 2024-05-01 22:57:47
合計ジャッジ時間 3,429 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
77,744 KB
testcase_01 AC 242 ms
78,080 KB
testcase_02 AC 183 ms
77,900 KB
testcase_03 AC 147 ms
77,824 KB
testcase_04 AC 211 ms
77,824 KB
testcase_05 AC 193 ms
77,928 KB
testcase_06 AC 197 ms
77,952 KB
testcase_07 AC 100 ms
78,208 KB
testcase_08 AC 112 ms
77,552 KB
testcase_09 AC 166 ms
77,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

max_ = 10 ** 5
isprime = [True] * (max_ + 1)
isprime[0] = isprime[1] = False
for i in range(2, int(max_ ** 0.5 + 1)):
    if not isprime[i]:
        continue
    for j in range(i * i, max_ + 1, i):
        isprime[j] = False
        
ans = [0] * (max_ + 1)
for i in range(1, max_ + 1):
    ans[i] = ans[i - 1] + isprime[i]
    
for _ in range(int(input())):
    print(ans[int(input())])
0