Description

Today is Saturday, 17th Nov,2007. Now, if i tell you a date, can you tell me what day it is ?       
              

Input

There are multiply cases.        One line is one case.        There are three integers, year(0<year<10000), month(0<=month<13), day(0<=day<32).       
              

Output

Output one line.        if the date is illegal, you should output "illegal". Or, you should output what day it is.       
        

Sample Input

2007 11 17
              

Sample Output

Saturday
 
 
注意这题细节很多,我是从0001年01月01日为周一考虑的。
 #include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
int a[]={, , , , , , , , , , , , };
int b[]={, , , , , , , , , , , , };
char c[][]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int panduan(int y)
{
if((y%== && y%!=) || y%==)
return ;
return ;
}
int main()
{
int y, m, d, sum, i;
while(cin>>y>>m>>d)
{
if(panduan(y))
{
if(d>b[m]||m==||d==)
{
cout << "illegal" << endl;
continue;
}
}
else
{
if(d>a[m]||m==||d==)
{
cout << "illegal" << endl;
continue;
}
}
sum=;
for (i=; i<y; ++i)
{
if(panduan(i))
sum += ;
else
sum += ; }
for(int i = ; i < m; ++i)
{
if(panduan(y))
sum += b[i];
else
sum += a[i]; }
sum+=d;
sum%=;
cout<< c[sum] << endl;
}
return ;
}

最新文章

  1. AM335x tscadc platform driver 相关代码跟踪
  2. BitCoin - BlockChain
  3. zTree插件之多选下拉菜单代码
  4. 约瑟夫问题(c++实现)
  5. windows进程/线程创建过程 --- windows操作系统学习
  6. Windows程序消息机制浅析
  7. redux学习笔记
  8. 暑假集训(1)第五弹 -----Rails(Uva514)
  9. ANDROID 自动生成动态表格for
  10. C#中的TCP通讯与UDP通讯
  11. python datetime时间差
  12. Python数据处理进阶——pandas
  13. P2P视频模块
  14. 「SDOI2017」树点涂色 解题报告
  15. 关于memset赋值问题
  16. python自动化开发-6-面向对象编程
  17. 实用技能之Python打包制作成EXE可执行程序
  18. Android之多种Bitmap效果
  19. Android Studio自动生成UML关系类图
  20. HDUOJ----1166敌兵布阵(线段树单点更新)

热门文章

  1. HBase系列文章汇总
  2. Andoird实现类似iphone AssistiveTouch的控件的demo
  3. chrome(转)
  4. Jafka来源分析——Processor
  5. HDU 5002 Tree
  6. C++输出数据到txt
  7. 策略模式Strategy——坐什么车回家?
  8. 它们的定义PropertyPlaceHolder无法完成更换任务
  9. Eclipse build launcher 3具体步骤
  10. Unicode字段也有collation