結果

問題 No.843 Triple Primes
ユーザー bellangeldindonbellangeldindon
提出日時 2019-06-28 22:29:15
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 608 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 191,816 KB
最終ジャッジ日時 2023-09-14 22:17:49
合計ジャッジ時間 13,815 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,512 KB
testcase_01 AC 433 ms
191,816 KB
testcase_02 AC 82 ms
76,100 KB
testcase_03 AC 81 ms
76,100 KB
testcase_04 AC 82 ms
76,288 KB
testcase_05 AC 82 ms
76,228 KB
testcase_06 AC 82 ms
76,296 KB
testcase_07 AC 329 ms
166,528 KB
testcase_08 AC 361 ms
175,188 KB
testcase_09 AC 414 ms
191,068 KB
testcase_10 AC 341 ms
167,468 KB
testcase_11 AC 382 ms
180,204 KB
testcase_12 AC 399 ms
187,828 KB
testcase_13 AC 387 ms
182,316 KB
testcase_14 AC 384 ms
182,340 KB
testcase_15 AC 332 ms
167,408 KB
testcase_16 AC 339 ms
167,248 KB
testcase_17 RE -
testcase_18 AC 74 ms
71,240 KB
testcase_19 AC 74 ms
71,368 KB
testcase_20 AC 140 ms
98,464 KB
testcase_21 AC 107 ms
83,864 KB
testcase_22 AC 233 ms
134,944 KB
testcase_23 AC 237 ms
136,528 KB
testcase_24 AC 143 ms
100,108 KB
testcase_25 AC 124 ms
92,056 KB
testcase_26 AC 407 ms
191,176 KB
testcase_27 AC 89 ms
77,808 KB
testcase_28 AC 392 ms
186,656 KB
testcase_29 AC 149 ms
102,560 KB
testcase_30 AC 402 ms
187,568 KB
testcase_31 AC 96 ms
79,604 KB
testcase_32 AC 85 ms
76,588 KB
testcase_33 AC 158 ms
106,972 KB
testcase_34 AC 215 ms
128,276 KB
testcase_35 AC 409 ms
191,248 KB
testcase_36 AC 120 ms
88,944 KB
testcase_37 AC 316 ms
161,740 KB
testcase_38 AC 267 ms
145,676 KB
testcase_39 AC 393 ms
187,648 KB
testcase_40 AC 74 ms
71,196 KB
testcase_41 RE -
testcase_42 AC 347 ms
174,300 KB
testcase_43 AC 377 ms
180,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
prime = []
numberlist = []
for i in range(2, N+1):
	numberlist.append(i)
while numberlist[0] <= int(math.sqrt(N)):
	now = numberlist.pop(0)
	prime.append(now)
	newnumberlist = []
	for i in range(0, len(numberlist)):
		if numberlist[i]%now != 0:
			newnumberlist.append(numberlist[i])
	numberlist = newnumberlist
prime = prime + numberlist
sqprime = []
for i in range(0, len(prime)):
	if prime[i]*prime[i] > 2*prime[-1]: break
	sqprime.append(prime[i]*prime[i])
cnt = 0
for i in range(0, len(sqprime)):
	if sqprime[i]-2 in prime:
		if i == 0: cnt += 1
		else: cnt += 2
print(cnt)
0