CodeForces
来源:互联网 发布:淘宝首页导航尺寸 编辑:程序博客网 时间:2024/06/16 20:53
点击打开链接
A. New Year and Days
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard 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.
memory limit per test256 megabytes
inputstandard input
outputstandard 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.
OutputPrint one integer — the number of candies Limak will save in the year 2016.
Examples
input:
4 of week
output:
52
input:
30 of month
output:
11
这道题就是要注意2016年是不是闰年的问题,只要这个明白,这题很水。
#include<cstdio>#include<cstring>int main(){char a[20],b[20];int k,i,n;while(scanf("%d %s %s",&n,a,b)!=EOF){if(!strcmp(b,"week")){if(n==5||n==6){printf("53\n");}else{printf("52\n");}}if(!strcmp(b,"month")){if(n==30){printf("11\n");}else if(n==31){printf("7\n");}else{printf("12\n");}}}return 0;}
阅读全文
0 0
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- HDU2222[Keywords Search] AC自动机裸题
- 华为机试——求int型正整数在内存中存储时1的个数
- 利用github和hexo搭建个人博客
- Bash read 接收键盘输入
- 修改mac默认的gcc到自己安装的gcc
- CodeForces
- [PAT乙级]1036. 跟奥巴马一起编程(15)
- python whl文件安装 发现依赖包缺少
- JavaScript知识点总结
- JAVA多线程学习--哲学家就餐问题
- Linux学习- CentOS各代区别 笔记大纲
- KMP算法详解, 关于NEXT数组及其改进
- 【CSS 基础】02 选择器
- LIBSVM的使用方法