New term and days
来源:互联网 发布:mysql with as 用法 编辑:程序博客网 时间:2024/05/17 06:57
New term and days
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.
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.
Print one integer — the number of candies Limak will save in the year 2016.
4 of week
52
30 of month
11
今天是星期三,一周中的第三天,明天就是2015年的最后一天。
Limak是一只小熊,它很期待2016年。
Limak靠吃糖维生,为了证明自己是有多么努力的活下去,他决定在2016年一整年中,定期的存一些糖。它考虑过很多种存糖方案,它可以在一周的某一天或者一个月的某一天存一颗糖。
Limak决定从两种方案中选择一种,但是他不知道按照这种方式,他会在2016年一整年存多少糖。请你计算后告诉它。
#include<cstdio> #include<algorithm> #include<cstring> using namespace std; int main(){ int x; char str1[10],str2[10]; while(scanf("%d %s %s",&x,str1,str2)==3){ if(strcmp(str2,"month")==0){ if(x<=29){ printf("12\n"); } else if(x==30){ printf("11\n"); } else if(x==31){ printf("7\n"); } } else if(strcmp(str2,"week")==0){ if(x==5||x==6){ printf("53\n"); } else{ printf("52\n"); } } } return 0; }
- New term and days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- New Year and Days
- A. New Year and Days
- Codeforces New Year and Days
- 【codeforces】New Year and Days
- G - New Year and Days
- 【codeforces】New Year and Days
- The New Term and New Beginning
- java抽象类抽象方法
- Android反编译软件(附图详细教程)
- 关于指针,可能是网上最详细的讲解了
- Leetcode 78 Subsets
- Java中精确到(保留)小数点后几位的方法
- New term and days
- 代码区,初始化全局数据区,BSS,堆区,栈区,程序环境变量区简介
- 打开Android Studio 2.2的视图检查器时遇到的问题
- 类和对象的基础2——对象的生与死(构造函数和析构函数)
- 栈区,堆区,全局区,文字常量区,程序代码区详解(程序中不同类型数据所在区)
- Linux命令(29):free
- android自定义View
- 仿iOS弹出Dialog
- [第一次机房收费系统]查询余额优化