結果

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

ソースコード

diff #
raw source code

N, D = map(int, input().split())
ans = 0
p = []
cnt =[0] * 8 * 10**6
## 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