結果
問題 | No.144 エラトステネスのざる |
ユーザー | mkawa2 |
提出日時 | 2020-01-03 00:44:50 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,009 bytes |
コンパイル時間 | 112 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 85,472 KB |
最終ジャッジ日時 | 2024-05-02 06:59:22 |
合計ジャッジ時間 | 11,696 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 526 ms
49,884 KB |
testcase_01 | AC | 535 ms
44,376 KB |
testcase_02 | AC | 539 ms
44,396 KB |
testcase_03 | AC | 528 ms
44,120 KB |
testcase_04 | AC | 527 ms
44,508 KB |
testcase_05 | AC | 530 ms
44,508 KB |
testcase_06 | AC | 529 ms
44,508 KB |
testcase_07 | AC | 534 ms
44,380 KB |
testcase_08 | AC | 528 ms
44,256 KB |
testcase_09 | AC | 530 ms
44,508 KB |
testcase_10 | AC | 538 ms
44,248 KB |
testcase_11 | AC | 536 ms
44,252 KB |
testcase_12 | AC | 536 ms
44,508 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
from itertools import * from bisect import * #from math import * from collections import * from heapq import * from random import * from decimal import * import numpy as np import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] dij = [(1, 0), (0, 1), (-1, 0), (0, -1)] def main(): n,p=input().split() n=int(n) p=float(p) ev=[1]*(n+1) ans=0 for x in range(2,n+1): ans+=ev[x] for y in range(x*2,n+1,x): ev[y]*=1-p print(ans) main()