結果

問題 No.800 四平方定理
ユーザー OKCH3COOHOKCH3COOH
提出日時 2019-11-13 21:20:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 299 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 11,792 KB
実行使用メモリ 181,276 KB
最終ジャッジ日時 2023-10-21 19:49:04
合計ジャッジ時間 5,524 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
16,924 KB
testcase_01 AC 105 ms
15,208 KB
testcase_02 AC 81 ms
12,576 KB
testcase_03 AC 85 ms
15,208 KB
testcase_04 AC 78 ms
12,576 KB
testcase_05 AC 88 ms
15,208 KB
testcase_06 AC 120 ms
15,208 KB
testcase_07 AC 99 ms
15,208 KB
testcase_08 AC 117 ms
15,208 KB
testcase_09 AC 104 ms
15,208 KB
testcase_10 TLE -
testcase_11 TLE -
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())

V = defaultdict(int)
for y in range(1, N + 1):
    for z in range(1, N + 1):
        V[y**2 + z**2] += 1

ans = 0
for w in range(1, N + 1):
    for x in range(1, N + 1):
        E = w**2 + D - x**2
        ans += V[E]

print(ans)
0