#include<stdio.h>
int main()
{
int year=2011,month=11,day=11,y,m,d,week=5,time,r;
int md[][12]= {{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }};
scanf("%d%d%d", &y, &m,&d);
time=10000*y+m*100+d;
if(time>20111111)
{
while(year!=y || month!=m || day!=d)
{
day++;
week=week+1>7?(week+1)%7:week+1;
if(year%4==0 &&year%100!=0 || year%400==0)//判断是闰年
r=1;
else
r=0;
if(md[r][month-1]<day)
{
day=1;
month++;
if(month>12)
{
month=1;
year++;
}
}
}
}
else if(time<20111111)
{
while(year!=y || month!=m || day!=d)
{
day--;
week=week-1==0?7:week-1;
if(year%4==0 &&year%100!=0 || year%400==0)//判断是闰年
r=1;
else
r=0;
if(day==0)
{
month--;
if(month==0)
{
month=12;
year--;
}
day=md[r][month-1];
}
}
}
printf("%d",week);
return 0;
}
0.0分
2 人评分
C二级辅导-计负均正 (C语言代码)浏览:652 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:597 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:737 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:701 |
WU-输出正反三角形 (C++代码)浏览:1099 |
Hello, world! (C++代码)浏览:1778 |
关于C语言变量位置的问题浏览:294 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:494 |
找出最长的字符串来 (C语言代码)浏览:1840 |
母牛的故事 (C语言代码)浏览:519 |