結果

問題 No.78 クジ付きアイスバー
ユーザー beetbeet
提出日時 2019-03-23 17:31:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,074 ms / 5,000 ms
コード長 486 bytes
コンパイル時間 2,247 ms
コンパイル使用メモリ 201,304 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 05:52:55
合計ジャッジ時間 44,844 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 514 ms
4,348 KB
testcase_06 AC 1,323 ms
4,348 KB
testcase_07 AC 527 ms
4,348 KB
testcase_08 AC 808 ms
4,348 KB
testcase_09 AC 2,670 ms
4,348 KB
testcase_10 AC 1,393 ms
4,348 KB
testcase_11 AC 694 ms
4,348 KB
testcase_12 AC 2,317 ms
4,348 KB
testcase_13 AC 2,464 ms
4,348 KB
testcase_14 AC 2,479 ms
4,348 KB
testcase_15 AC 976 ms
4,348 KB
testcase_16 AC 1,758 ms
4,348 KB
testcase_17 AC 2,061 ms
4,348 KB
testcase_18 AC 2,088 ms
4,348 KB
testcase_19 AC 2,213 ms
4,348 KB
testcase_20 AC 2,388 ms
4,348 KB
testcase_21 AC 2,753 ms
4,348 KB
testcase_22 AC 2,489 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 4 ms
4,348 KB
testcase_34 AC 579 ms
4,348 KB
testcase_35 AC 833 ms
4,348 KB
testcase_36 AC 2,188 ms
4,348 KB
testcase_37 AC 2,864 ms
4,348 KB
testcase_38 AC 3,074 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n,k;
  string s;
  cin>>n>>k>>s;
  int ans=0,cnt=0,res=0,pos=0;
  while(cnt<k){
    if(res>0) res--;
    else ans++;
    res+=s[pos]-'0';
    cnt++;
    pos++;
    if(pos>=n) pos-=n;
  }
  cout<<ans<<endl;
  return 0;
}
0