結果

問題 No.1096 Range Sums
ユーザー uni_pythonuni_python
提出日時 2020-06-26 22:02:32
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 106,976 KB
最終ジャッジ日時 2023-09-18 05:13:42
合計ジャッジ時間 2,556 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,440 KB
testcase_01 AC 75 ms
71,456 KB
testcase_02 AC 74 ms
71,412 KB
testcase_03 AC 74 ms
71,148 KB
testcase_04 AC 74 ms
71,284 KB
testcase_05 AC 73 ms
71,580 KB
testcase_06 AC 75 ms
71,364 KB
testcase_07 AC 75 ms
71,284 KB
testcase_08 AC 74 ms
71,320 KB
testcase_09 AC 74 ms
71,472 KB
testcase_10 AC 123 ms
106,968 KB
testcase_11 AC 123 ms
106,944 KB
testcase_12 AC 123 ms
106,976 KB
testcase_13 AC 121 ms
106,840 KB
testcase_14 AC 122 ms
106,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N=I()
    A=LI()
    
    def sum2(x):
        return (x*(x+1))//2
    
    def calc(k):#k番目
        temp=sum2(k-1)*2
        temp+=k*(N-(k-1)*2)
        return temp
    
    ans=0
    B=[0]*N
    for i in range(N):
        d=calc(min(i+1,N-i))
        B[i]=A[i]*d
        
    print(sum(B))
        


main()
0