結果

問題 No.929 よくあるボールを移動するやつ
ユーザー brthyyjpbrthyyjp
提出日時 2020-04-30 14:43:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 165 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 89,216 KB
最終ジャッジ日時 2023-08-22 01:45:41
合計ジャッジ時間 2,997 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,388 KB
testcase_01 AC 69 ms
71,312 KB
testcase_02 AC 66 ms
71,392 KB
testcase_03 AC 69 ms
71,268 KB
testcase_04 AC 68 ms
71,092 KB
testcase_05 AC 68 ms
71,212 KB
testcase_06 AC 67 ms
71,216 KB
testcase_07 AC 80 ms
79,928 KB
testcase_08 AC 91 ms
89,104 KB
testcase_09 AC 91 ms
88,980 KB
testcase_10 AC 88 ms
89,216 KB
testcase_11 AC 86 ms
89,152 KB
testcase_12 AC 86 ms
88,884 KB
testcase_13 AC 87 ms
89,156 KB
testcase_14 AC 85 ms
88,956 KB
testcase_15 AC 89 ms
89,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
B = list(map(int, input().split()))

ans = 0
cum = 0
for i in range(n):
    cum += B[i]
    if cum != i+1:
        ans += abs(cum-(i+1))
print(ans)
0