結果

問題 No.800 四平方定理
ユーザー OKCH3COOH
提出日時 2019-11-13 21:20:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 335 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 101,108 KB
最終ジャッジ日時 2024-09-21 21:14:48
合計ジャッジ時間 5,602 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 10 TLE * 2 -- * 18
権限があれば一括ダウンロードができます

ソースコード

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