1. 程式人生 > >2008 數值統計

2008 數值統計

return scanf color pro 技術 img num warn war

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

技術分享圖片

#pragma warning(disable:4996) 
#include<stdio.h>
int main() {
    int n;
    double num;
    int a, b, c;

    while (scanf("%d ", &n),n )
    {
        a = b = c = 0;
        for (int i = 0; i < n; i++)
        {
            scanf(
"%lf", &num); if (num < 0) a++; else if (num > 0) c++; else b++; } printf("%d %d %d\n", a ,b,c); } return 0; }

2008 數值統計