結果

問題 No.1007 コイン集め
ユーザー hirakuhiraku
提出日時 2020-04-08 05:22:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 19,092 KB
最終ジャッジ日時 2023-09-23 03:57:14
合計ジャッジ時間 2,473 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,888 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 16 ms
7,868 KB
testcase_03 AC 15 ms
7,728 KB
testcase_04 AC 16 ms
7,716 KB
testcase_05 AC 16 ms
7,860 KB
testcase_06 AC 15 ms
7,760 KB
testcase_07 AC 15 ms
7,888 KB
testcase_08 AC 15 ms
7,680 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 73 ms
19,064 KB
testcase_13 AC 69 ms
19,092 KB
testcase_14 AC 68 ms
19,068 KB
testcase_15 AC 34 ms
10,336 KB
testcase_16 AC 33 ms
10,392 KB
testcase_17 AC 33 ms
10,528 KB
testcase_18 AC 71 ms
18,752 KB
testcase_19 AC 48 ms
18,752 KB
testcase_20 WA -
testcase_21 AC 59 ms
18,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = 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
    
ans -= A[k - 1]

print(ans)
0