fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a, b = 0, c = 0;
  6.  
  7. while (cin >> a){
  8.  
  9. if(a<0){
  10. c++;
  11. }
  12. if(a>0){
  13. b++;
  14. }
  15. if(a==0)
  16. break;
  17. }
  18. cout<<b<<" "<<c;
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5320KB
stdin
5
-2
7
-8
0
stdout
2 2