結果
問題 | No.78 クジ付きアイスバー |
ユーザー |
![]() |
提出日時 | 2020-05-11 22:37:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2,679 ms / 5,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 3,988 ms |
コンパイル使用メモリ | 165,968 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 07:21:11 |
合計ジャッジ時間 | 43,549 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N, K;string S;cin >> N >> K >> S;for (auto& c : S)c -= '0';int ans = 0;int free = 0;while (K--) {static int now = 0;if (free) {free--;} elseans++;free += S[now++];if (now == N) now = 0;}cout << ans << endl;}