結果
問題 |
No.78 クジ付きアイスバー
|
ユーザー |
![]() |
提出日時 | 2017-10-17 18:33:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 559 bytes |
コンパイル時間 | 1,394 ms |
コンパイル使用メモリ | 159,804 KB |
実行使用メモリ | 10,024 KB |
最終ジャッジ日時 | 2024-11-17 22:38:52 |
合計ジャッジ時間 | 95,538 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 TLE * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; typedef pair<int, int> P; int n, k; string s; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n >> k >> s; int cur = 0, ans = 0; FOR(i, k) { if (cur == 0) { ans++; cur += s[i%n]-'0'; } else { cur--; cur += s[i%n]-'0'; } } cout << ans << endl; return 0; }