結果
問題 | No.106 素数が嫌い!2 |
ユーザー |
|
提出日時 | 2020-05-07 11:12:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 3,005 ms / 5,000 ms |
コード長 | 1,097 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 48,480 KB |
最終ジャッジ日時 | 2024-07-03 09:22:44 |
合計ジャッジ時間 | 21,549 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
import sys, refrom collections import deque, defaultdict, Counterfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, logfrom itertools import accumulate, permutations, combinations, productfrom operator import itemgetter, mul, addfrom copy import deepcopyfrom string import ascii_lowercase, ascii_uppercase, digitsfrom bisect import bisect, bisect_leftfrom heapq import heappush, heappopfrom functools import reduce, lru_cachedef input(): return sys.stdin.readline().strip()def INT(): return int(input())def MAP(): return map(int, input().split())def LIST(): return list(map(int, input().split()))def ZIP(n): return zip(*(MAP() for _ in range(n)))sys.setrecursionlimit(10 ** 9)INF = float('inf')mod = 10 ** 9 + 7N, K = MAP()def sieve(n):s = [True] * nfor x in range(2, int(n ** 0.5) + 1):if s[x]:for i in range(x + x, n, x):s[i] = Falsereturn [i for i in range(n) if s[i] and i > 1]ans = 0l = [0] * (N+1)for n in sieve(N+1):tmp = 1while n*tmp <= N:l[n*tmp] += 1tmp += 1ans = 0for v in l:ans += 1*(v>=K)print(ans)