Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
54
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. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5. int main()
  6. {
  7.   int n, masyvas[100], ats = 0, max = 0;
  8.   cin >> n;
  9.   for(int i = 0; i < n; i++)
  10.     cin >> masyvas[i];
  11.   for(int i=0;i<n;i++)
  12. {
  13.     if(masyvas[i] == 0) {
  14.         ++ats;
  15.         if (ats > max) {
  16.             max = ats;
  17.         }
  18.     }
  19.     else
  20.     {
  21.         ats = 0;
  22.     }
  23. }
  24.  
  25.   if(max == 0 )
  26. {
  27.     cout<<"No"<<endl;
  28. }
  29. else
  30. {
  31. cout << max << endl;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement