結果

問題 No.731 等差数列がだいすき
ユーザー roarisroaris
提出日時 2022-11-26 16:15:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 1,500 ms
コード長 246 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 82,412 KB
実行使用メモリ 60,232 KB
最終ジャッジ日時 2024-04-14 03:11:42
合計ジャッジ時間 2,283 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 40 ms
52,424 KB
testcase_02 AC 36 ms
52,568 KB
testcase_03 AC 37 ms
52,760 KB
testcase_04 AC 43 ms
58,696 KB
testcase_05 AC 38 ms
52,300 KB
testcase_06 AC 43 ms
58,908 KB
testcase_07 AC 42 ms
58,568 KB
testcase_08 AC 41 ms
58,248 KB
testcase_09 AC 39 ms
58,716 KB
testcase_10 AC 42 ms
59,012 KB
testcase_11 AC 38 ms
52,520 KB
testcase_12 AC 47 ms
58,932 KB
testcase_13 AC 46 ms
58,828 KB
testcase_14 AC 42 ms
58,912 KB
testcase_15 AC 43 ms
58,564 KB
testcase_16 AC 44 ms
58,472 KB
testcase_17 AC 51 ms
59,012 KB
testcase_18 AC 50 ms
60,232 KB
testcase_19 AC 50 ms
58,520 KB
testcase_20 AC 51 ms
59,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0