結果

問題 No.800 四平方定理
ユーザー anagohirameanagohirame
提出日時 2019-03-17 23:29:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 335 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 178,188 KB
最終ジャッジ日時 2023-09-22 11:40:30
合計ジャッジ時間 8,404 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
177,376 KB
testcase_01 AC 130 ms
178,068 KB
testcase_02 AC 129 ms
177,920 KB
testcase_03 AC 130 ms
177,648 KB
testcase_04 AC 129 ms
177,864 KB
testcase_05 AC 129 ms
178,012 KB
testcase_06 AC 130 ms
177,720 KB
testcase_07 AC 133 ms
178,188 KB
testcase_08 AC 129 ms
177,800 KB
testcase_09 AC 130 ms
177,928 KB
testcase_10 AC 217 ms
178,128 KB
testcase_11 AC 200 ms
178,128 KB
testcase_12 AC 199 ms
178,020 KB
testcase_13 AC 190 ms
177,860 KB
testcase_14 AC 196 ms
177,864 KB
testcase_15 AC 203 ms
178,052 KB
testcase_16 AC 204 ms
178,060 KB
testcase_17 AC 196 ms
177,688 KB
testcase_18 AC 204 ms
177,980 KB
testcase_19 AC 215 ms
177,984 KB
testcase_20 AC 119 ms
177,468 KB
testcase_21 AC 118 ms
177,052 KB
testcase_22 AC 207 ms
177,908 KB
testcase_23 AC 268 ms
177,868 KB
testcase_24 AC 263 ms
177,896 KB
testcase_25 AC 268 ms
177,688 KB
testcase_26 AC 123 ms
177,324 KB
testcase_27 AC 121 ms
177,088 KB
testcase_28 AC 258 ms
178,104 KB
testcase_29 AC 263 ms
178,060 KB
testcase_30 AC 258 ms
177,852 KB
testcase_31 AC 250 ms
177,800 KB
testcase_32 AC 264 ms
178,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
ans = 0
sahen = [0] * 8000001
uhen = [0] * 5000001
for x in range(1, n+1):
	for y in range(1, n+1):
		sahen[x**2 + y**2] += 1
for z in range(1, n+1):
	for w in range(1, n+1):
		if w**2 + d - z**2 >= 0:
			uhen[w**2 + d - z**2] += 1
ans = 0
for i in range(5000001):
	ans += sahen[i] * uhen[i]
print(ans)
0