I - Numerical statistics HDU - 2008
Counting the number of a given number n, negative, zero and positive numbers.
Input
A plurality of input data sets, each one row, each row is a first integer number n (n <100), is the number of values need to be calculated, then the real number n; if n = 0, it indicates that the input end, the bank does not process.
Output
For each set of input data, an output line a, b and C, respectively, represent data given negative, and a positive number of zeros.
Sample Input
6 0 1 2 3 -1 0 5 1 2 3 4 0.5 0
Sample Output
1 2 3 0 0 5
Code Example:
#include<stdio.h>
#define N 100
int main()
{
int n;
while(~scanf("%d",&n)&&n){
int m,a,b,c;
a=b=c=0;
while(n--){
scanf("%f",&m);
if(m<0) a++;
else if(!m) b++;
else c++;
}
printf("%d %d %d\n",a,b,c);
}
}