結果

問題 No.800 四平方定理
ユーザー lloyzlloyz
提出日時 2022-11-03 13:24:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 322 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 311,440 KB
最終ジャッジ日時 2023-09-24 22:53:26
合計ジャッジ時間 36,023 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
81,452 KB
testcase_01 AC 132 ms
86,880 KB
testcase_02 AC 122 ms
82,728 KB
testcase_03 AC 124 ms
85,760 KB
testcase_04 AC 121 ms
82,872 KB
testcase_05 AC 121 ms
84,576 KB
testcase_06 AC 128 ms
89,300 KB
testcase_07 AC 123 ms
85,732 KB
testcase_08 AC 129 ms
89,020 KB
testcase_09 AC 122 ms
86,724 KB
testcase_10 AC 1,070 ms
251,484 KB
testcase_11 AC 1,125 ms
260,956 KB
testcase_12 AC 1,226 ms
260,576 KB
testcase_13 AC 1,125 ms
251,652 KB
testcase_14 AC 1,267 ms
260,912 KB
testcase_15 AC 1,240 ms
260,892 KB
testcase_16 AC 1,232 ms
261,072 KB
testcase_17 AC 1,267 ms
261,220 KB
testcase_18 AC 1,177 ms
261,104 KB
testcase_19 AC 1,145 ms
261,092 KB
testcase_20 AC 91 ms
71,680 KB
testcase_21 AC 89 ms
71,504 KB
testcase_22 AC 1,159 ms
261,268 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 94 ms
71,728 KB
testcase_27 AC 93 ms
71,672 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n, d = map(int, input().split())

counter = defaultdict(int)
for w in range(1, n + 1):
    for z in range(1, n + 1):
        counter[w**2 - z**2] += 1

ans = 0
for x in range(1, n + 1):
    for y in range(1, n + 1):
        res = x**2 + y**2 - d
        ans += counter[res]
print(ans)
0