結果
| 問題 |
No.78 クジ付きアイスバー
|
| コンテスト | |
| ユーザー |
eri
|
| 提出日時 | 2015-07-28 23:53:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3,541 ms / 5,000 ms |
| コード長 | 261 bytes |
| コンパイル時間 | 715 ms |
| コンパイル使用メモリ | 55,004 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 17:28:20 |
| 合計ジャッジ時間 | 39,910 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 35 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
int main(){
int n, k; string s;
cin >> n >> k >> s;
int cnt = 0, stk = 0, p = 0;
while (k--){
if (p == n) p = 0;
(stk > 0) ? stk-- : cnt++;
stk += (int)(s[p++] - '0');
}
cout << cnt << endl;
}
eri