求为什么会output limit exceeded
给出年月日,计算改日是该年第几天#include<stdio.h>//求某个日期在一年中是第几天 172
int sum(int month, int day)
{
int a[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
for (int i = 1;i < month;i++)
day += a[i];
return day;
}
int main()
{
int year, month, day, sum1 = 0,leap=0;
while (1)
{
scanf("%d-%d-%d", &year, &month, &day);
if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0)leap = 1;
sum1 = sum(month, day);
if (leap==1&&month>2)printf("%d\n", sum1 + 1);
else printf("%d\n", sum1);
}
return 0;
}
结果是output limit exceeded,为什么?