結果

問題 No.731 等差数列がだいすき
ユーザー 💕💖💞💕💖💞
提出日時 2018-09-12 23:47:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 136 ms / 1,500 ms
コード長 270 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 32,880 KB
最終ジャッジ日時 2023-09-10 11:05:54
合計ジャッジ時間 6,520 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
30,440 KB
testcase_01 AC 131 ms
30,492 KB
testcase_02 AC 131 ms
30,452 KB
testcase_03 AC 132 ms
30,572 KB
testcase_04 AC 132 ms
30,740 KB
testcase_05 AC 131 ms
30,640 KB
testcase_06 AC 134 ms
30,644 KB
testcase_07 AC 132 ms
30,508 KB
testcase_08 AC 132 ms
30,688 KB
testcase_09 AC 132 ms
30,692 KB
testcase_10 AC 134 ms
30,640 KB
testcase_11 AC 132 ms
30,960 KB
testcase_12 AC 132 ms
30,572 KB
testcase_13 AC 132 ms
30,852 KB
testcase_14 AC 135 ms
32,228 KB
testcase_15 AC 132 ms
30,712 KB
testcase_16 AC 133 ms
30,616 KB
testcase_17 AC 132 ms
30,764 KB
testcase_18 AC 136 ms
30,692 KB
testcase_19 AC 131 ms
32,880 KB
testcase_20 AC 131 ms
30,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

def solve(n, qs):
    res = np.polyfit(list(range(n)), qs, 1, full=True)
    return res[0][1], res[0][0], res[1][0]

n = int(input())
qs = [int(q) for q in input().split()]
b0, d, cost = solve(n, qs)
print(f"{b0:.12f} {d:.12f}")
print(f"{cost:.12f}")
0