結果

問題 No.800 四平方定理
ユーザー OKCH3COOHOKCH3COOH
提出日時 2019-11-13 21:20:57
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 335 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 11,700 KB
実行使用メモリ 97,680 KB
最終ジャッジ日時 2023-10-21 19:50:22
合計ジャッジ時間 26,073 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
12,616 KB
testcase_01 AC 90 ms
12,616 KB
testcase_02 AC 71 ms
12,616 KB
testcase_03 AC 75 ms
12,616 KB
testcase_04 AC 69 ms
12,616 KB
testcase_05 AC 80 ms
12,616 KB
testcase_06 AC 101 ms
15,248 KB
testcase_07 AC 104 ms
15,248 KB
testcase_08 AC 130 ms
15,248 KB
testcase_09 AC 87 ms
12,616 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
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
        if E < 0:
            break
        ans += V[E]

print(ans)
0