結果

問題 No.1007 コイン集め
ユーザー nebukuro09nebukuro09
提出日時 2020-03-06 21:49:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 289 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,812 KB
最終ジャッジ日時 2024-04-22 06:53:31
合計ジャッジ時間 2,379 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 WA -
testcase_10 AC 30 ms
10,752 KB
testcase_11 WA -
testcase_12 AC 92 ms
21,808 KB
testcase_13 AC 91 ms
21,812 KB
testcase_14 AC 91 ms
21,780 KB
testcase_15 AC 52 ms
13,072 KB
testcase_16 AC 51 ms
13,072 KB
testcase_17 AC 52 ms
13,072 KB
testcase_18 AC 93 ms
21,524 KB
testcase_19 AC 67 ms
21,652 KB
testcase_20 WA -
testcase_21 AC 80 ms
21,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
k -= 1
ans = a[k]

if a[k] == 0:
    print(0)
    exit(0)

for i in range(k-1, -1, -1):
    ans += a[i]
    if a[i] <= 1:
        break

for i in range(k+1, n):
    ans += a[i]
    if a[i] <= 1:
        break

print(ans)
0