結果

問題 No.78 クジ付きアイスバー
コンテスト
ユーザー A63635985
提出日時 2018-03-03 11:28:18
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 647 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 -479,510 ms
コンパイル使用メモリ 75,380 KB
実行使用メモリ 16,072 KB
最終ジャッジ日時 2026-03-09 03:30:16
合計ジャッジ時間 139,980 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12 TLE * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
/usr/bin/ld: cannot open output file a.out: テキストファイルがビジー状態です
collect2: error: ld returned 1 exit status

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int to_int(char tmp){
        int integer;
        string t="";t+=tmp;
        istringstream to(t);
        to>>integer;
        return integer;
}
int main(){
        int N,K;
        string str;
        cin >> N >>K;
        cin >> str;
        long long int counter=0;
        int hit=0;
        int i=0;
        while(K>0){
                int tmp=to_int(str[i]);
                if(hit==0 )counter++;
                else hit--;
                hit+=tmp;
                K--;
                i=(i+1)%N;
        }
        cout << counter << endl;
        return 0;
}
0