Zzuli OJ 1083: Numerical statistics (multi-instance testing)

Source: Internet
Author: User



Description

Counts the number of negative, 0, and positive numbers in a given n number

Input

There are several groups of input data, 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, that line is not processed.

Output

For each set of input data, the output line, a, B, and C, respectively, indicates the number of negative, 0, and positive numbers in the given data.

Sample Input6 0 1 2 3-1 1 2 3 4 0.50Sample Output1 2 0 5HINT

Source

#include <stdio.h>int main () {int n,a[100][3]; float x; int i=0,j; scanf ("%d", &n); while (n!=0) {  a[i][0]=a[ i][1]=a[i][2]=0;  for (j=0;j<n;j++)  {   scanf ("%f", &x);   if (x<0)    a[i][0]++;   else if (x==0)    a[i][1]++;   else    a[i][2]++;  }  scanf ("%d", &n);  i++; } for (j=0;j<i;j++)  printf ("%d%d%d\n", a[j][0],a[j][1],a[j][2]);}


Copyright NOTICE: This article is the original blogger articles, reproduced please indicate the source.

Zzuli OJ 1083: Numerical statistics (multi-instance testing)

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.