結果

問題 No.2632 Center of Three Points in Lp Norm
ユーザー maspy
提出日時 2024-02-16 23:31:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 70,292 KB
最終ジャッジ日時 2024-09-28 22:27:10
合計ジャッジ時間 54,081 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 14 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import scipy
from scipy import optimize

p = float(input())
x1, y1 = map(float, input().split())
x2, y2 = map(float, input().split())
x3, y3 = map(float, input().split())

def f(point):
    x, y = point
    d1 = abs(x1 - x) ** p + abs(y1 - y) ** p
    d2 = abs(x2 - x) ** p + abs(y2 - y) ** p
    d3 = abs(x3 - x) ** p + abs(y3 - y) ** p
    return (d2 - d1) ** 2 + (d3 - d1) ** 2 + (d3 - d2) ** 2

x_min = optimize.minimize(f, x0=[0, 0])
print(*x_min.x)
0