Description
中国有句俗语叫“三天打鱼两天晒网”。某人从1990年1月1日起开始“三天打鱼两天晒网”。问这个人在以后的某一天中是在“打鱼”,还是在“晒网”。
Input
该题有多组测试数据,每组数据一行,含有三个整数Y,M,D
Output
对于每组输入,输出当天是否在打鱼,若是输出"fishing",否则输出"no fishing"
Sample Input
1991 10 25
Sample Output
fishing
KEY:这题,咋看没什么……其实很有鬼啊……居然计算过程会超出long long 太可怕了,所以要用到求模的方法,还是很麻烦的一题……
Source:

#include<iostream>
using namespace std;


int f[]=...{0,31,28,31,30,31,30,31,31,30,31,30,31};

int countleap(unsigned long year)

...{
return (year-1-1992)/4+1;
}

int leap(unsigned long year)

...{
if(year%400==0) return 1;
if(year%4==0&&year%100!=0) return 1;
return 0;
}

int main()

...{
// freopen("fjnu_1758.in","r",stdin);
unsigned long day,year,month;
while(cin>>year>>month>>day)

...{
int l;
if(year>1992)

...{
l=countleap(year);
}
else l=0;
day+=l%5;
if(leap(year)&&month>2) day++;
for(int i=1;i<=month-1;i++)
day+=f[i];
day=day%5;
if(day>=1&&day<=3) cout<<"fishing"<<endl;
else cout<<"no fishing"<<endl;
}
return 0;
}







