为什么总是提示Output Limit Exceeded?

Problem Description
给定一个日期,输出这个日期是该年的第几天。
Input
输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。
Output
对于每组输入数据,输出一行,表示该日期是该年的第几天。
Sample Input
1985/1/20
2006/3/12
Sample Output
20
71

我编的代码:
#include <iostream>
#include <stdio.h>
using namespace std;
bool leapyear(int a)
{
if (a%100!=0&&a%4==0||a%400==0)
return true;
else
return false;
}
int month(int y,int m)
{
if (leapyear(y))
{if (m==2)
return 29;
else if (m==1||m==3||m==5||m==7||m==8||m==10)
return 31;
else
return 30;
}
else
{
if (m==2)
return 28;
else if (m==1||m==3||m==5||m==7||m==8||m==10)
return 31;
else
return 30;
}
}
void main()
{
int y,m,d,i=1;
while(scanf("%d/%d/%d",&y,&m,&d))
{
if (m==i)
{ cout <<d<<endl;
continue;
}
else
{
while (i<m)
{
d=d+month(y,i);
i++;
}
cout <<d<<endl;
}
i=1;
}
}

为甚总是提示Output Limit Exceeded啊?

没有啊,怎么出现的?给个例子?

温馨提示:答案为网友推荐,仅供参考
相似回答