結果

問題 No.1007 コイン集め
ユーザー komkompikomkompi
提出日時 2020-04-04 12:03:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 526 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 19,020 KB
最終ジャッジ日時 2023-09-16 05:34:23
合計ジャッジ時間 1,969 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,780 KB
testcase_01 AC 15 ms
7,792 KB
testcase_02 AC 15 ms
7,824 KB
testcase_03 AC 15 ms
7,848 KB
testcase_04 RE -
testcase_05 AC 15 ms
7,796 KB
testcase_06 AC 15 ms
7,924 KB
testcase_07 AC 16 ms
7,796 KB
testcase_08 AC 16 ms
7,848 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 37 ms
10,936 KB
testcase_17 AC 36 ms
10,832 KB
testcase_18 WA -
testcase_19 AC 55 ms
19,008 KB
testcase_20 RE -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N,K=map(int,input().split())

def kill(lis):
    lis_index=0
    for i in range(len(lis)):
        if lis[i]==0:
            lis_index==i
            break
        elif lis[i]==1:
            lis_index=i+1
            break
    return lis[:lis_index]

A=[0]+list(map(int,input().split()))+[0]

L=A[:K]
#print(kill(L[::-1]))

R=A[K+1:]
#print(kill(R))

score=[sum(kill(L[::-1])),sum(kill(R))]

if A[K]>=2:
    print(sum(score)+A[K])
elif A[K]==1:
    print(max(socre)+A[K])
else:
    print(0)
0