Problem 385A Runtime Error on test case 15?

Правка en1, от winaichan263, 2015-09-23 06:48:20

Is there something wrong with this?

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    vector<int> bears;
	int len = s.length();
    for(int i = 0; i < len; i++){
        if(s[i] == 'b' && i+3 < len){
            if(s[i+1] == 'e' && s[i+2] == 'a' && s[i+3] == 'r') bears.push_back(i);
        }
    }
    int bi = 0;
    long long count = 0;
    for(int i = 0; i <= bears[bears.size()-1]; i++){
        if(i <= bears[bi]) count += len-(bears[bi]+3);
        else{
            if(bi < bears.size()-1) count += len-(bears[++bi]+3);
        }
    }
    cout << count;
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский winaichan263 2015-09-23 06:48:20 727 Initial revision (published)