結果

問題 No.1096 Range Sums
ユーザー uni_pythonuni_python
提出日時 2020-06-26 22:03:14
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,012 KB
実行使用メモリ 23,592 KB
最終ジャッジ日時 2023-09-18 05:14:07
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,816 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 17 ms
7,928 KB
testcase_03 AC 17 ms
7,780 KB
testcase_04 AC 15 ms
7,820 KB
testcase_05 AC 15 ms
7,768 KB
testcase_06 AC 16 ms
7,852 KB
testcase_07 AC 16 ms
7,848 KB
testcase_08 AC 16 ms
7,980 KB
testcase_09 AC 16 ms
7,876 KB
testcase_10 AC 221 ms
23,552 KB
testcase_11 AC 214 ms
23,452 KB
testcase_12 AC 212 ms
23,428 KB
testcase_13 AC 213 ms
23,536 KB
testcase_14 AC 214 ms
23,592 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