結果
問題 |
No.731 等差数列がだいすき
|
ユーザー |
|
提出日時 | 2022-11-26 16:15:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 1,500 ms |
コード長 | 246 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 82,540 KB |
実行使用メモリ | 60,132 KB |
最終ジャッジ日時 | 2024-10-03 00:27:31 |
合計ジャッジ時間 | 1,865 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
N = int(input()) a = list(map(int, input().split())) S = sum(a) T = sum((i+1)*a[i] for i in range(N)) d = (T-(N+1)/2*S)/(N*(N+1)*(2*N+1)//6-N*(N+1)**2/4) b = (S-N*(N+1)//2*d)/N c = sum((b+(i+1)*d-a[i])**2 for i in range(N)) print(b+d, d) print(c)