A10414 | The Same Calendar
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The girl Taylor has a beautiful calendar for the year $y$ . In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
The calendar is so beautiful that she wants to know what is the next year after $y$ when the calendar will be exactly the same. Help Taylor to find that year.
Note that leap years has $366$ days. The year is leap if it is divisible by $400$ or it is divisible by $4$ , but not by $100$ ([https://en.wikipedia.org/wiki/Leap\_year](https://en.wikipedia.org/wiki/Leap_year)).
The calendar is so beautiful that she wants to know what is the next year after $y$ when the calendar will be exactly the same. Help Taylor to find that year.
Note that leap years has $366$ days. The year is leap if it is divisible by $400$ or it is divisible by $4$ , but not by $100$ ([https://en.wikipedia.org/wiki/Leap\_year](https://en.wikipedia.org/wiki/Leap_year)).
输入格式
The only line contains integer $y$ ( $1000<=y<100'000$ ) — the year of the calendar.
输出格式
Print the only integer $y'$ — the next year after $y$ when the calendar will be the same. Note that you should find the first year after $y$ with the same calendar.
输入输出样例
输入 #1
2016
输出 #1
2044
输入 #2
2000
输出 #2
2028
输入 #3
50501
输出 #3
50507
Today is Monday, the $13$ th of June, $2016$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted