题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2008
#include <stdio.h>
int main(void)
{
int n, i, a, b, c;
double x;
while (scanf("%d", &n) , n)
{
a = b = c = 0;
for (i = 0 ; i < n ; i++)
{
scanf("%lf", &x);
if (x > 0) c++;
else if (x < 0) a++;
else b++;
}
printf("%d %d %d\n", a, b, c);
}
return 0;
}
本文提供了一个简单的C语言程序来解决HDU 2008竞赛题目,该程序通过读取一系列浮点数并统计其中正数、负数及零的数量。采用标准输入输出方式,适用于ACM竞赛训练。
612

被折叠的 条评论
为什么被折叠?



