結果

問題 No.800 四平方定理
ユーザー AEnAEn
提出日時 2022-05-16 10:23:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 289 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 86,848 KB
実行使用メモリ 336,908 KB
最終ジャッジ日時 2023-10-12 02:26:07
合計ジャッジ時間 29,375 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
87,044 KB
testcase_01 AC 130 ms
89,056 KB
testcase_02 AC 126 ms
84,700 KB
testcase_03 AC 128 ms
88,064 KB
testcase_04 AC 123 ms
84,692 KB
testcase_05 AC 131 ms
86,824 KB
testcase_06 AC 137 ms
92,632 KB
testcase_07 AC 126 ms
88,284 KB
testcase_08 AC 138 ms
92,532 KB
testcase_09 AC 133 ms
89,572 KB
testcase_10 AC 1,751 ms
260,696 KB
testcase_11 TLE -
testcase_12 AC 1,957 ms
302,400 KB
testcase_13 AC 1,857 ms
266,876 KB
testcase_14 AC 1,986 ms
303,004 KB
testcase_15 AC 1,902 ms
302,656 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 101 ms
71,944 KB
testcase_21 AC 101 ms
71,700 KB
testcase_22 TLE -
testcase_23 TLE -
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())

p, n = defaultdict(int), defaultdict(int)
for i in range(1, N+1):
    for j in range(1, N+1):
        p[i**2 + j**2] += 1
        n[i**2 - j**2] += 1

res = 0
for key in p.keys():
    res += p[key]*n[D-key]
print(res)
0