hdu2008 Numeric Statistics "C + +"

Source: Internet
Author: User

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 + +"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.