結果

問題 No.800 四平方定理
ユーザー heno239
提出日時 2019-03-14 14:55:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 293 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 45,936 KB
最終ジャッジ日時 2024-07-01 19:39:03
合計ジャッジ時間 31,294 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d=map(int,input().split())
cnt=[0]*4500001
for i in range(1,n+1):
    for j in range(1,n+1):
        s=j*j-i*i+d
        if s>=0:
            cnt[s]+=1
ans=0
for i in range(1,n+1):
    ans+=cnt[2*i*i]
for i in range(1,n+1):
    for j in range(i+1,n+1):
        ans+=2*cnt[i*i+j*j]
print(ans)
0