結果

問題 No.78 クジ付きアイスバー
ユーザー kurenai3110
提出日時 2017-02-01 16:41:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-24 02:18:28
合計ジャッジ時間 2,173 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = list(map(int,input().split()))
s=input()

x=0
cnt=0
C = [0]
for i,c in enumerate(s):
        if x:
            x-=1
        else:
            cnt+=1
        x+=int(c)
        C.append(cnt)
if x==0:
    cnt*=k//len(s)
    k%=len(s)
    cnt+=C[k]
elif x<cnt:
    a = [i for i in range(cnt-x+1)][::-x]
    cnt += sum(a)
    
print(cnt)
0