結果
問題 | No.106 素数が嫌い!2 |
ユーザー | tonnnura172 |
提出日時 | 2020-05-07 11:12:49 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 2,682 ms / 5,000 ms |
コード長 | 1,097 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 10,820 KB |
実行使用メモリ | 46,808 KB |
最終ジャッジ日時 | 2023-09-16 07:50:18 |
合計ジャッジ時間 | 19,674 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,293 ms
28,520 KB |
testcase_01 | AC | 29 ms
9,720 KB |
testcase_02 | AC | 29 ms
9,836 KB |
testcase_03 | AC | 29 ms
9,708 KB |
testcase_04 | AC | 1,281 ms
28,448 KB |
testcase_05 | AC | 2,682 ms
46,780 KB |
testcase_06 | AC | 2,665 ms
46,764 KB |
testcase_07 | AC | 2,547 ms
46,688 KB |
testcase_08 | AC | 185 ms
12,240 KB |
testcase_09 | AC | 185 ms
12,316 KB |
testcase_10 | AC | 2,651 ms
46,808 KB |
testcase_11 | AC | 1,089 ms
26,440 KB |
testcase_12 | AC | 2,547 ms
45,468 KB |
testcase_13 | AC | 31 ms
9,816 KB |
testcase_14 | AC | 29 ms
9,712 KB |
testcase_15 | AC | 31 ms
9,808 KB |
ソースコード
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul, add from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from heapq import heappush, heappop from functools import reduce, lru_cache def 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 + 7 N, K = MAP() def sieve(n): s = [True] * n for x in range(2, int(n ** 0.5) + 1): if s[x]: for i in range(x + x, n, x): s[i] = False return [i for i in range(n) if s[i] and i > 1] ans = 0 l = [0] * (N+1) for n in sieve(N+1): tmp = 1 while n*tmp <= N: l[n*tmp] += 1 tmp += 1 ans = 0 for v in l: ans += 1*(v>=K) print(ans)