結果

問題 No.78 クジ付きアイスバー
ユーザー woodsgreen
提出日時 2022-01-13 00:28:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 264 bytes
コンパイル時間 1,985 ms
コンパイル使用メモリ 191,400 KB
最終ジャッジ日時 2025-01-27 10:42:43
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 TLE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int n,k,cnt,ans;
char s[60];
int main(){
    cin>>n>>k>>s;
    for(int i=0;k>0;i=(i+1)%n,--k){
        if(cnt) --cnt;
        else ++ans;
        cnt+=s[i]-'0';
    }
    cout<<ans<<endl;
    return 0;
}
0