当前位置:网站首页>日期(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;
}
边栏推荐
- Sword finger offer 45. arrange the array into the smallest number
- sqlilabs less-28~less-8a
- Equal proportion of R language test group: use the prop.test function to test whether the success proportion of the two groups is equal
- (2022 Niuke multi School II) k-link with bracket sequence I (dynamic planning)
- Softing pnGate系列网关:将PROFIBUS总线集成到PROFINET网络
- "Everyday Mathematics" serial 61: March 1
- 线性代数(三)
- (Niuke multi school I in 2022) i-chiitoitsu (expected DP)
- 剑指 Offer 36. 二叉搜索树与双向链表
- Why is it that all the games are pseudorandom and can't make true random?
猜你喜欢

10、渲染基础

Sword finger offer 05. replace spaces

Siggraph 2022 -- rendering iridescent rock dove neck feathers

Amazoncaptcha bypasses Amazon IP verification code with 95% success rate

Unity animator animation and state machine

求求你别再用 System.currentTimeMillis() 统计代码耗时了,真的太 Low 了!
![(16) [system call] track system call (3 rings)](/img/b0/011351361135fd9f8e2d0d31749f73.png)
(16) [system call] track system call (3 rings)
![[ultra detailed diagram] FPN + mask RCNN](/img/ef/ddd62fe7e54074c134aa5ee4cc5840.png)
[ultra detailed diagram] FPN + mask RCNN

Unity Animator动画与状态机

HTB-Arctic
随机推荐
Unity animator animation and state machine
HTB-Optimum
(Niuke multi school I in 2022) i-chiitoitsu (expected DP)
剑指 Offer 32 - I. 从上到下打印二叉树
Unity accesses chartandgraph chart plug-in
"Everyday Mathematics" serial 61: March 1
求求你别再用 System.currentTimeMillis() 统计代码耗时了,真的太 Low 了!
R language Visual scatter diagram, geom using ggrep package_ text_ The repl function avoids overlapping labels between data points (set the hJust parameter to show that labels of all data points are a
Differences and application directions of GPS, base station and IP positioning
Leetcode/ integer division
Introduction summary of using unirx in unity
2020icpc Jiangxi warm up e.robot sends red packets (DFS)
ERA5数据集说明
2021年ICPC陕西省赛热身赛 B.CODE(位运算)
Sword finger offer 36. binary search tree and bidirectional linked list
R language uses LM function to build multiple linear regression model and write regression equation according to model coefficient
2020ICPC 江西省赛热身赛 E.Robot Sends Red Packets(dfs)
Draw Bezier curve through screen interaction
Y76. Chapter IV Prometheus large factory monitoring system and practice -- Prometheus advanced (VII)
Netease game Flink SQL platform practice