求助,我这两个有什么区别吗?
#include <stdio.h>int main ()
{
int n,t,a=0,b=0,c=0,m;
while (scanf ("%d",&n)!=EOF)
{
for (t=0;t<=n;t++)
{ scanf ("%d",&m);
if (m<0) a++;
if (m=0) b++;
if (m>0) c++;
}
printf ("%d%d%d\n",a,b,c);
}
return 0;
}
#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;
}
为什么后者可以通过,而前者则提示Output Limit Exceeded
大神教教我吧!