結果

問題 No.800 四平方定理
ユーザー OKCH3COOHOKCH3COOH
提出日時 2019-11-13 21:33:53
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 318 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 511,892 KB
最終ジャッジ日時 2023-10-21 19:51:07
合計ジャッジ時間 5,511 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
94,620 KB
testcase_01 AC 142 ms
121,752 KB
testcase_02 AC 114 ms
107,080 KB
testcase_03 AC 123 ms
111,408 KB
testcase_04 AC 113 ms
103,224 KB
testcase_05 AC 118 ms
107,072 KB
testcase_06 AC 150 ms
132,012 KB
testcase_07 AC 128 ms
113,704 KB
testcase_08 AC 150 ms
135,672 KB
testcase_09 AC 140 ms
123,800 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N, D = map(int, input().split())

YZ = defaultdict(int)
WDX = defaultdict(int)

for i in range(1, N + 1):
    for j in range(1, N + 1):
        YZ[i * i + j * j] += 1
        WDX[D + i * i - j * j] += 1

ans = 0
for yz in range(2 * N**2 + 1):
    ans += YZ[yz] * WDX[yz]
print(ans)
0