結果

問題 No.800 四平方定理
ユーザー wgrapewgrape
提出日時 2023-10-31 13:57:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 349 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 303,060 KB
最終ジャッジ日時 2023-10-31 13:58:28
合計ジャッジ時間 31,102 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
70,304 KB
testcase_01 AC 66 ms
75,460 KB
testcase_02 AC 62 ms
71,744 KB
testcase_03 AC 65 ms
74,456 KB
testcase_04 AC 61 ms
71,740 KB
testcase_05 AC 64 ms
73,564 KB
testcase_06 AC 70 ms
77,864 KB
testcase_07 AC 65 ms
74,460 KB
testcase_08 AC 72 ms
77,864 KB
testcase_09 AC 68 ms
75,460 KB
testcase_10 AC 884 ms
251,032 KB
testcase_11 AC 920 ms
259,796 KB
testcase_12 AC 947 ms
259,240 KB
testcase_13 AC 858 ms
258,484 KB
testcase_14 AC 956 ms
259,804 KB
testcase_15 AC 956 ms
259,524 KB
testcase_16 AC 925 ms
246,180 KB
testcase_17 AC 994 ms
246,172 KB
testcase_18 AC 945 ms
246,172 KB
testcase_19 AC 947 ms
246,176 KB
testcase_20 AC 39 ms
53,544 KB
testcase_21 AC 38 ms
53,544 KB
testcase_22 AC 934 ms
246,180 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 39 ms
53,544 KB
testcase_27 AC 38 ms
53,544 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,844 ms
287,892 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int,input().split())

from collections import defaultdict
# x^2 + y^2で作れる数を全列挙
XY = defaultdict(int)
for x in range(1, N + 1):
    for y in range(1, N + 1):
        XY[x**2 + y ** 2] += 1
        
ans = 0
for z in range(1, N + 1):
    for w in range(1, N + 1):
        ans += XY[D - (z ** 2 - w ** 2)]
        
print(ans)
0