CodeForces 611A New Year and Days
2016-01-11 18:28
337 查看
A. New Year and Days
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.
Limak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year 2016.
Limak wants to prove how responsible a bear he is. He is going to regularly save candies for the entire year 2016! He considers various saving plans. He can save one candy either on some fixed day of the week or on some fixed day of the month.
Limak chose one particular plan. He isn't sure how many candies he will save in the 2016 with his plan. Please, calculate it and tell him.
Input
The only line of the input is in one of the following two formats:
"x of week" where x (1 ≤ x ≤ 7)
denotes the day of the week. The 1-st day is Monday and the 7-th one is Sunday.
"x of month" where x (1 ≤ x ≤ 31)
denotes the day of the month.
Output
Print one integer — the number of candies Limak will save in the year 2016.
Sample test(s)
input
output
input
output
Note
Polar bears use the Gregorian calendar. It is the most common calendar and you likely use it too. You can read about it on Wikipedia if you want to – https://en.wikipedia.org/wiki/Gregorian_calendar.
The week starts with Monday.
In the first sample Limak wants to save one candy on each Thursday (the 4-th day of the week). There are 52 Thursdays in the 2016. Thus, he will
save 52 candies in total.
In the second sample Limak wants to save one candy on the 30-th day of each month. There is the 30-th day in exactly 11 months in the 2016 — all
months but February. It means that Limak will save 11 candies in total.
我明明记得昨天一起发了啊,怎么没了呢,补发一下。这题查准确日历就好了
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.
Limak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year 2016.
Limak wants to prove how responsible a bear he is. He is going to regularly save candies for the entire year 2016! He considers various saving plans. He can save one candy either on some fixed day of the week or on some fixed day of the month.
Limak chose one particular plan. He isn't sure how many candies he will save in the 2016 with his plan. Please, calculate it and tell him.
Input
The only line of the input is in one of the following two formats:
"x of week" where x (1 ≤ x ≤ 7)
denotes the day of the week. The 1-st day is Monday and the 7-th one is Sunday.
"x of month" where x (1 ≤ x ≤ 31)
denotes the day of the month.
Output
Print one integer — the number of candies Limak will save in the year 2016.
Sample test(s)
input
4 of week
output
52
input
30 of month
output
11
Note
Polar bears use the Gregorian calendar. It is the most common calendar and you likely use it too. You can read about it on Wikipedia if you want to – https://en.wikipedia.org/wiki/Gregorian_calendar.
The week starts with Monday.
In the first sample Limak wants to save one candy on each Thursday (the 4-th day of the week). There are 52 Thursdays in the 2016. Thus, he will
save 52 candies in total.
In the second sample Limak wants to save one candy on the 30-th day of each month. There is the 30-th day in exactly 11 months in the 2016 — all
months but February. It means that Limak will save 11 candies in total.
我明明记得昨天一起发了啊,怎么没了呢,补发一下。这题查准确日历就好了
#include<cstdio> #include<cstring> int rec[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; int main() { int t; char tem[10],time[20]; while(~scanf("%d",&t)) { scanf("%s%s",tem,time); if(time[0]=='w') { if(t==5||t==6) printf("53\n"); else printf("52\n"); } else { if(t==31) printf("7\n"); else if(t==30) printf("11\n"); else printf("12\n"); } } return 0; }
相关文章推荐
- linux学习笔记02
- uiautomator基本操作命令
- 从僵尸网络追踪到入侵检测 第5章 使用Honeyd创建防御路由模板
- 蓝桥杯 历届试题 最大子阵
- Atom与markdown
- 基本emmet使用
- 说一说常见的刷单方式-刷单一天能挣多少钱
- BBB sdcard Ubuntu系统下载地址
- idea 控制台乱码
- ASP.NET 5 简介
- JavaScript setInterval()執行clearInterval() 再恢復setInterval()
- Mina运行流程解析(一)
- sql分页全部有 分页后查不到
- CentOS 7启动时不启动桌面服务【systemd】
- iOS开发-自定义键盘
- Carrier-Grade Mirantis OpenStack (the Mirantis NFV Initiative), Part 1: Single Root I/O Virtualization (SR-IOV)
- NSTimer及一些补充(CADisplayLink)
- 获取验证码倒计时
- leangoo,不容小觑的协作工具
- HashMap