結果

問題 No.800 四平方定理
コンテスト
ユーザー 910_sendai
提出日時 2019-03-18 12:42:13
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 293 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 811 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 155,364 KB
最終ジャッジ日時 2026-04-01 22:42:43
合計ジャッジ時間 31,914 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, D = map(int, input().split())
ans = 0
p = []
cnt =[0] * (8 * 10**6 + 1)
## x*x + y*y = s 
for i in range(1, N+1):
    p.append(i*i)

for z in p:
    for w in p:
        s = w - z + D
        if s >= 0:
            cnt[s] += 1

for x in p:
    for y in p:
        ans += cnt[x+y]

print(ans)
0