結果

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

ソースコード

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