結果

問題 No.843 Triple Primes
ユーザー 双六双六
提出日時 2020-07-22 16:29:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 90,068 KB
最終ジャッジ日時 2023-09-02 21:09:55
合計ジャッジ時間 9,656 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
89,592 KB
testcase_01 AC 139 ms
89,952 KB
testcase_02 AC 135 ms
89,764 KB
testcase_03 AC 135 ms
89,972 KB
testcase_04 AC 130 ms
89,804 KB
testcase_05 AC 132 ms
89,884 KB
testcase_06 AC 130 ms
89,564 KB
testcase_07 AC 138 ms
90,024 KB
testcase_08 AC 139 ms
89,920 KB
testcase_09 AC 145 ms
89,732 KB
testcase_10 AC 138 ms
90,040 KB
testcase_11 AC 141 ms
89,616 KB
testcase_12 AC 142 ms
89,764 KB
testcase_13 AC 138 ms
89,852 KB
testcase_14 AC 142 ms
89,952 KB
testcase_15 AC 137 ms
89,972 KB
testcase_16 AC 139 ms
89,916 KB
testcase_17 AC 127 ms
89,528 KB
testcase_18 WA -
testcase_19 AC 134 ms
89,472 KB
testcase_20 AC 140 ms
89,960 KB
testcase_21 AC 141 ms
90,036 KB
testcase_22 AC 144 ms
89,964 KB
testcase_23 AC 138 ms
90,068 KB
testcase_24 AC 137 ms
89,920 KB
testcase_25 AC 132 ms
89,748 KB
testcase_26 AC 141 ms
89,796 KB
testcase_27 AC 135 ms
89,796 KB
testcase_28 AC 139 ms
89,732 KB
testcase_29 AC 136 ms
89,780 KB
testcase_30 AC 147 ms
89,764 KB
testcase_31 AC 140 ms
89,920 KB
testcase_32 AC 128 ms
89,860 KB
testcase_33 AC 131 ms
89,840 KB
testcase_34 AC 133 ms
89,964 KB
testcase_35 AC 142 ms
89,744 KB
testcase_36 AC 134 ms
89,808 KB
testcase_37 AC 136 ms
89,764 KB
testcase_38 AC 133 ms
89,884 KB
testcase_39 AC 141 ms
89,744 KB
testcase_40 WA -
testcase_41 AC 130 ms
89,624 KB
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

num = 10 ** 6 + 1 #適当に値を入れる
L = [1 for i in range(num)]; L[0] = 0; L[1] = 0
plist = []
for i in range(num):
	if L[i] == 1:
		plist.append(i); c = 2
		while i * c <= num - 1:
			L[i * c] = 0; c += 1

#処理内容
def main():
	N = int(input())
	ans = 0
	for r in plist:
		if r ** 2 > N:
			break
		for p in plist:
			if p >= r ** 2:
				break
			if L[r ** 2 - p] == 1:
				# print(p, r**2-p, r, r**2)
				ans += 1

	print(ans)





if __name__ == '__main__':
	main()
0