結果

問題 No.78 クジ付きアイスバー
ユーザー imulanimulan
提出日時 2016-01-22 19:56:39
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 772 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 73,792 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-16 06:03:52
合計ジャッジ時間 15,044 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,320 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1,139 ms
5,376 KB
testcase_06 AC 2,963 ms
5,376 KB
testcase_07 AC 1,175 ms
5,376 KB
testcase_08 AC 1,800 ms
5,376 KB
testcase_09 TLE -
testcase_10 AC 3,256 ms
5,376 KB
testcase_11 AC 1,574 ms
5,376 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 2,179 ms
5,376 KB
testcase_16 AC 3,949 ms
5,376 KB
testcase_17 AC 4,656 ms
5,376 KB
testcase_18 TLE -
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 <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
using namespace std;

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)

int main(int argc, char const *argv[]) {
  int n,k;
  string s;
  cin >>n >>k >>s;

  int b=0; //buy
  int st=0; //stock
  REP(j,k){
    if(st>0) --st;
    else ++b;

    st+=s[j%n]-'0';
  }
  //printf("b:%d, st:%d\n",b,st);

  std::cout << b << std::endl;
  return 0;
}
0