結果

問題 No.78 クジ付きアイスバー
ユーザー mogurockermogurocker
提出日時 2017-10-17 18:33:10
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 559 bytes
コンパイル時間 1,416 ms
コンパイル使用メモリ 159,948 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-04-29 00:50:42
合計ジャッジ時間 36,640 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1,138 ms
6,940 KB
testcase_06 AC 2,958 ms
6,940 KB
testcase_07 AC 1,177 ms
6,940 KB
testcase_08 AC 1,806 ms
6,940 KB
testcase_09 TLE -
testcase_10 AC 3,104 ms
6,944 KB
testcase_11 AC 1,556 ms
6,944 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 2,182 ms
6,944 KB
testcase_16 AC 3,925 ms
6,944 KB
testcase_17 AC 4,591 ms
6,940 KB
testcase_18 AC 4,701 ms
6,940 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0