您的位置:首页 > 其它

nyoj-219-An problem about date

2013-07-25 19:02 337 查看
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
int year,month,day,c,y,week;
while(scanf("%d%d%d",&year,&month,&day)!=EOF)
{
if(month==1||month==2)//判断month是否为1或2
{
year--;
month+=12;
}
c=year/100;
y=year-c*100;
week=y+(y/4)+(c/4)-2*c+(26*(month+1)/10)+day-1;
printf("%d\n",(week%7+7)%7);
}
return 0;
}


这个题就是公式 前提是 你得知道并且会用
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: