What day is it
Description
Input
Output
Sample Input
Sample Output
#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 ;
}
随机推荐
- HDU 3836 Equivalent SetsTarjan+缩点)
Problem Description To prove two sets A and B are equivalent, we can first prove A is a subset of B, ...
- python网络爬虫学习笔记
python网络爬虫学习笔记 By 钟桓 9月 4 2014 更新日期:9月 4 2014 文章文件夹 1. 介绍: 2. 从简单语句中開始: 3. 传送数据给server 4. HTTP头-描写叙述 ...
- Eclipse——热键&Help
版权声明:本文博主原创文章.博客,未经同意不得转载.
- 流量计算-Jstorm提交Topology过程(下一个)
马上部分流量计算-Jstorm提交Topology过程(上), 5.上篇任务已经ServiceHandler.submitTopologyWithOpts()方法.在该方法中,会实例化一个Topolo ...
- webclient下载文件 带进度条
private void button1_Click(object sender, EventArgs e) { doDownload(textBox1.Text.Trim()); } private ...
- ProgressMonitorInputStream
Swing类包中有一个很有用的流过滤器,ProgressMonitorInputStream,它可以自动弹出一个对话框,监视已经读取了多少流. 进度监视器流使用InputStream类的availab ...
- 一个简单的RPC框架
一个 系统模型 二.数据库代码实现 1. mkdir database cd database vim dbInit.c /* * * Database Init tool * */ #include ...
- [Ext JS 4] 实战Chart 协调控制(单一的坐标,两个坐标)
前言
- UVA 1358 - Generator(dp+高斯消元+KMP)
UVA 1358 - Generator option=com_onlinejudge&Itemid=8&page=show_problem&category=524& ...
- MyEclipse—怎样在MyEclipse中创建servlet3.0
servlet3.0随着Java EE6规范一起公布,那么怎样在MyEclipse中创建3.0版的servlet呢? 1.启动MyEclipse.获得下图: 2.点击上图"File" ...