Advertisement
simushin_pavel

Untitled

Nov 24th, 2020
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4.     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  5.     long long ans=0, a, sign=-1; cin >> a;
  6.     if(a>0) sign=1;
  7.     while(a){
  8.         cin >> a;
  9.         if(a*sign<0){
  10.             ++ans;
  11.             sign*=-1;
  12.         }
  13.     }
  14.     cout << ans;
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement