Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <set>
- #include <map>
- #include <cstring>
- #include <algorithm>
- #include <stack>
- #include <queue>
- #include <fstream>
- using namespace std;
- typedef long long ll;
- int main() {
- int n;
- cin >> n;
- int niza[n];
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- int najgolem = 0;
- for(int i = 0; i < n; i++) {
- int broj_na_trojki = 0;
- for(int j = i; j < n; j++) {
- if(niza[j] == 3) {
- broj_na_trojki++;
- }
- if(broj_na_trojki == 3) {
- if(najgolem < j - i) {
- najgolem = j - i;
- }
- }
- }
- }
- cout << najgolem + 1 << endl;
- return 0;
- }
- /*
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement