vlatkovski

Igra

Sep 17th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, po_red = 0, najveke = 0;
  7.     cin >> n;
  8.  
  9.     for (int i = 0; i < n; i++) {
  10.         int x;
  11.         cin >> x;
  12.  
  13.         if (x == 2) {
  14.             po_red = 0;
  15.         } else {
  16.             po_red++;
  17.         }
  18.  
  19.         if (po_red > najveke) {
  20.             najveke = po_red;
  21.         }
  22.     }
  23.  
  24.     cout << najveke << endl;
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment