結果

問題 No.106 素数が嫌い!2
ユーザー tonnnura172tonnnura172
提出日時 2020-05-07 11:13:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 308 ms / 5,000 ms
コード長 1,097 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 123,032 KB
最終ジャッジ日時 2023-09-16 07:48:58
合計ジャッジ時間 4,945 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
101,468 KB
testcase_01 AC 155 ms
80,412 KB
testcase_02 AC 156 ms
80,348 KB
testcase_03 AC 156 ms
80,240 KB
testcase_04 AC 224 ms
101,656 KB
testcase_05 AC 293 ms
123,032 KB
testcase_06 AC 293 ms
122,980 KB
testcase_07 AC 308 ms
122,868 KB
testcase_08 AC 166 ms
83,616 KB
testcase_09 AC 168 ms
83,456 KB
testcase_10 AC 291 ms
122,944 KB
testcase_11 AC 214 ms
98,920 KB
testcase_12 AC 292 ms
120,428 KB
testcase_13 AC 155 ms
80,372 KB
testcase_14 AC 156 ms
80,348 KB
testcase_15 AC 160 ms
81,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0