結果

問題 No.731 等差数列がだいすき
ユーザー 👑 KazunKazun
提出日時 2021-02-19 19:30:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 1,500 ms
コード長 247 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 74,936 KB
最終ジャッジ日時 2023-10-14 21:56:48
合計ジャッジ時間 3,774 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,176 KB
testcase_01 AC 77 ms
71,072 KB
testcase_02 AC 74 ms
70,936 KB
testcase_03 AC 76 ms
71,004 KB
testcase_04 AC 79 ms
74,808 KB
testcase_05 AC 74 ms
71,228 KB
testcase_06 AC 78 ms
74,912 KB
testcase_07 AC 79 ms
71,336 KB
testcase_08 AC 81 ms
74,832 KB
testcase_09 AC 83 ms
74,860 KB
testcase_10 AC 77 ms
74,860 KB
testcase_11 AC 72 ms
71,232 KB
testcase_12 AC 77 ms
71,332 KB
testcase_13 AC 78 ms
74,868 KB
testcase_14 AC 78 ms
74,740 KB
testcase_15 AC 79 ms
74,896 KB
testcase_16 AC 80 ms
71,400 KB
testcase_17 AC 81 ms
74,856 KB
testcase_18 AC 76 ms
74,856 KB
testcase_19 AC 78 ms
74,936 KB
testcase_20 AC 79 ms
74,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))

P=sum(A)
Q=sum([i*A[i] for i in range(N)])

M=(N-1)*N*(N+1)

b=(N-1)*(2*N-1)*P-3*(N-1)*Q
b*=2/M
d=-3*(N-1)*P+6*Q
d*=2/M

X=0
p=b
for i in range(N):
    X+=pow(A[i]-p,2)
    p+=d

print(b,d)
print(X)
0