hdu2008

数值统计

http://acm.hdu.edu.cn/showproblem.php?pid=2008

   1 #include<stdio.h>
   2 int main()
   3 {int i,n,a,b,c;double x[100];
   4     while(scanf("%d",&n)!=EOF)
   5          {
   6            if(n==0||n>=100) continue;
   7            a=0;b=0;c=0;
   8          for(i=0;i<n;i++)
   9             scanf("%lf",&x[i]);
  10          for(i=0;i<n;i++)
  11             {if(x[i]<0) a=a+1;
  12 
  13             if(x[i]==0) b=b+1;
  14 
  15             if(x[i]>0) c=c+1;
  16             }
  17          printf("%d %d %d\n",a,b,c);
  18          }
  19 }

hdu2008 (2008-06-02 12:33:39由czk编辑)