結果
問題 | No.78 クジ付きアイスバー |
ユーザー |
![]() |
提出日時 | 2018-03-03 11:28:18 |
言語 | C++11 (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 647 bytes |
コンパイル時間 | 511 ms |
コンパイル使用メモリ | 58,000 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-06-23 20:20:51 |
合計ジャッジ時間 | 7,308 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 TLE * 1 -- * 33 |
ソースコード
#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; }