Numerical statistics
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 128331 Accepted Submission (s): 61807
Problem description counts the number of negative, 0, and positive numbers given in the N number.
Input data has multiple groups, one row per group, the first number of each row is an integer n (n<100), the number of values that need to be counted, and then n real numbers, and if n=0, then the input ends and the row is not processed.
Output for each set of input data, outputs a row, a, B, and C, respectively, representing the number of negative, 0, and positive numbers in the given data.
Sample INPUT6 0 1 2 3-1 05 1 2 3 4 0.50
Sample OUTPUT1 2 30 0 5
1#include <cstdio>2 using namespacestd;3 intMain ()4 {5 intN;6 while(SCANF ("%d", &n) &&N)7 {8 Doublex;9 intNegnum =0, Zeronum =0, Posnum =0;Ten while(n--) One { Ascanf"%LF",&x); - if(X <0) - { thenegnum++; - } - Else if(X >0) - { +posnum++; - } + Else A { atzeronum++; - } - } -printf"%d%d%d\n", negnum,zeronum,posnum); - } - return 0; in}
hdu2008 Numeric Statistics "C + +"