結果

問題 No.731 等差数列がだいすき
ユーザー kozykozy
提出日時 2020-07-26 14:59:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 1,500 ms
コード長 268 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,388 KB
最終ジャッジ日時 2023-09-11 01:34:57
合計ジャッジ時間 1,777 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,864 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 AC 15 ms
7,820 KB
testcase_03 AC 16 ms
7,960 KB
testcase_04 AC 16 ms
7,788 KB
testcase_05 AC 15 ms
7,856 KB
testcase_06 AC 16 ms
7,780 KB
testcase_07 AC 17 ms
7,916 KB
testcase_08 AC 16 ms
7,924 KB
testcase_09 AC 16 ms
7,784 KB
testcase_10 AC 16 ms
8,296 KB
testcase_11 AC 16 ms
7,924 KB
testcase_12 AC 16 ms
7,920 KB
testcase_13 AC 16 ms
7,856 KB
testcase_14 AC 17 ms
7,856 KB
testcase_15 AC 17 ms
7,920 KB
testcase_16 AC 16 ms
7,960 KB
testcase_17 AC 17 ms
7,868 KB
testcase_18 AC 17 ms
8,356 KB
testcase_19 AC 17 ms
8,248 KB
testcase_20 AC 17 ms
8,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
L=list(map(int,input().split()))
a=0
d=0
e=0
R=range(1,N+1)
for i in range(N):
    a+=(i+1)*L[i]
    e+=(i+1)**2
b=sum(L)
c=((1+N)*N)//2
d=N*a-b*c
f=N*e-c**2
A=d/f
n=e*b-a*c
B=n/f
print(A+B,A)
Q=0
for i in range(N):
    Q+=(L[i]-(A*(i+1)+B))**2
print(Q)
0