結果

問題 No.78 クジ付きアイスバー
ユーザー not_522
提出日時 2015-07-20 11:38:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 319 bytes
コンパイル時間 1,218 ms
コンパイル使用メモリ 160,112 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-11-08 00:38:51
合計ジャッジ時間 66,568 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 34 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  long long n, k, res = 0, r = 0;
  string s;
  cin >> n >> k >> s;
  while (k) {
    for (int i = 0; i < (int)s.size(); ++i) {
      if (r) --r;
      else ++res;
      r += s[i] - '0';
      --k;
      if (k == 0) break;
    }
  }
  cout << res << endl;
}
0