結果

問題 No.800 四平方定理
ユーザー OKCH3COOH
提出日時 2019-11-13 21:43:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 358 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 148,736 KB
最終ジャッジ日時 2024-09-21 21:17:22
合計ジャッジ時間 28,821 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 TLE * 1
other AC * 12 TLE * 9 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())
L = [i * i for i in range(1, N + 1)]

YZ = [0] * (2 * (N**2) + 1)
for i in L:
    for j in L:
        YZ[i + j] += 1

XW = [0] * (2 * (N**2) + 1 + D)
for w in L:
    for x in L:
        if D + w - x < 0:
            break
        XW[D + w - x] += 1

ans = 0
for i in range(2 * (N**2) + 1):
    ans += YZ[i] * XW[i]
print(ans)
0