Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n, masyvas[100], ats = 0, max = 0;
  9.     cin >> n;
  10.     for (int i = 0; i < n; i++)
  11.         cin >> masyvas[i];
  12.     for (int i = 0; i < n; i++)
  13.     {
  14.         if (masyvas[i] == 0)
  15.         {
  16.             ++ats;
  17.             if (ats > max)
  18.             {
  19.                 max = ats;
  20.             }
  21.         }
  22.         else
  23.         {
  24.             ats = 0;
  25.         }
  26.     }
  27.  
  28.     if (max == 0)
  29.     {
  30.         cout << "No" << endl;
  31.     }
  32.     else
  33.     {
  34.         cout << max << endl;
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement