fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6. int a[1000], i, n, d, c, y;
  7. cin >> n;
  8. y=0;
  9. c=0;
  10. d=0;
  11.  
  12. for ( i = 0; i<n;i++ )
  13. {cin >> a[i];
  14. if (a[i]>0) y++;
  15.  
  16. if (a[i]<0) c++;
  17.  
  18. if (a[i]==0) d++;
  19. }
  20. cout << y << endl << c << endl << d << endl ;
  21. for ( i = 0; i<n;i++ )
  22. cout << a[i]<< " ";
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 4460KB
stdin
10
2
0
0
-3
-4
5
5
6
7
2
stdout
6
2
2
2 0 0 -3 -4 5 5 6 7 2