当前位置:网站首页>日期(DAY 76)
日期(DAY 76)
2022-07-25 06:01:00 【张学恒】
1:题目
今天是 2012 年 4 月 12 日星期四,编写程序,输入今天开始到 12 月 31 日之间的任意日期,输出那一天是星期几。
输入格式
共两行,第一行包含一个整数 m,表示询问日期的月份。
第二行包含一个整数 d,表示询问日期的为该月的第几天。
输出格式
输出询问日期是星期几。
注意,要用英文表示。
周一到周日的英文表示如下:
"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"
数据范围
4≤m≤12,
1≤d≤31,
保证日期合法。
输入样例:
5
20
输出样例:
Sunday
2:代码实现
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int months[] = {
0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
int main()
{
int month, date;
cin >> month >> date;
int m = 4, d = 12, day = 4;
while (m < month || d < date)
{
d ++ ;
if (d > months[m])
{
d = 1;
m ++ ;
}
day = (day + 1) % 7;
}
string names[] = {
"Sunday", "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
};
cout << names[day] << endl;
return 0;
}
边栏推荐
- Amazoncaptcha 95%成功率绕过亚马逊IP验证码
- ABC 261.D - Flipping and Bonus ( DP )
- (2022 Niuke multi School II) l-link with level editor I (dynamic planning)
- QT qtextedit setting qscrollbar style sheet does not take effect solution
- Productivity tool in the new era -- flowus information flow comprehensive evaluation
- Unity model simplification / consolidation one click plug-in
- Concepts of phase velocity and phase in transmission line theory
- Netease game Flink SQL platform practice
- sqlilabs less-28~less-8a
- Pdf snapshot artifact
猜你喜欢

An SQL execution process

Programming hodgepodge (I)
![(14)[驱动开发]配置环境 VS2019 + WDK10 写 xp驱动](/img/90/0d94d26be8128d77de65919763fda5.png)
(14)[驱动开发]配置环境 VS2019 + WDK10 写 xp驱动

Siggraph 2022 -- rendering iridescent rock dove neck feathers

Unity accesses chartandgraph chart plug-in

New discovery of ROS callback function

Baidu, Alibaba, Tencent, who fell first?

阻塞队列分析

剑指 Offer 36. 二叉搜索树与双向链表

新时代生产力工具——FlowUs 息流全方位评测
随机推荐
Bug --- redis deserialization failed
QT qtextedit setting qscrollbar style sheet does not take effect solution
HTB-Arctic
(16)[系统调用]追踪系统调用(3环)
R language obtains the data row where the nth maximum value of the specified data column is located in the data.table data
Get URL of [url reference]? For the following parameters, there are two ways to get the value of the corresponding parameter name and convert the full quantity to the object structure
[typescript manual]
EOL offline sequence based on iso13209 (Otx)
HTB-Arctic
Common methods of JS operation array
CCID released the "Lake warehouse integrated technology research report", and Jushan database was selected as a typical representative of domestic enterprises
(2022牛客多校二)K-Link with Bracket Sequence I(动态规划)
(2022牛客多校)D-Link with Game Glitch(spfa)
Softing pnGate系列网关:将PROFIBUS总线集成到PROFINET网络
(Niuke multi School II) G-LINK with monotonic subsequence (construction question)
(牛客多校二)G-Link with Monotonic Subsequence(构造题)
idea常用10个快捷键
sqlilabs less-29
(14) [driver development] configuration environment vs2019 + wdk10 write XP driver
leetcode/ 前 n 个数字二进制中 1 的个数