Advertisement
hopingsteam

Untitled

Apr 3rd, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("bac.in");
  7.  
  8. int main()
  9. {
  10.     int neg1 = -1, neg2;
  11.     int x;
  12.     int poz = 1;
  13.     while(fin >> x)
  14.     {
  15.         if(x < 0 && neg1 == -1)
  16.             neg1 = poz;
  17.         if(x < 0)
  18.             neg2 = poz;
  19.         poz++;
  20.     }
  21.     poz = poz - 1;
  22.     int d1 = poz - neg1 + 1;
  23.     cout << max(d1, neg2);
  24.    
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement