結果

問題 No.800 四平方定理
ユーザー hedwig100
提出日時 2020-04-24 10:52:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 323 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 168,004 KB
最終ジャッジ日時 2024-10-15 01:47:06
合計ジャッジ時間 22,300 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 27 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
def main():
    n,d = map(int,input().split())
    square = np.arange(1,n + 1) ** 2
    Add = np.bincount(np.add.outer(square,square).flatten())
    Sub = (square[:,None] - square[None,:]).flatten() + d
    Sub = Sub[Sub >= 0]
    ans = Add[Sub].sum()
    print(ans)
if __name__ =='__main__':
    main() 
0