A. New Year and Days

题目连接:

http://www.codeforces.com/contest/611/problem/A

Description

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 Input

4 of week

Sample Output

52

Hint

题意:

给你两种询问,1.问你2016年中周x有多少天,2.问你2016年中x号一共有多少天。

题解:

数日历。

代码

#include<bits/stdc++.h>
using namespace std;int C(int year,int month,int day)
{if(month<3){year-=1;month+=12;}int c=(int)(year/100),y=year - 100*c;int w=(int)(c/4)-2*c+y+int(y/4)+(26*(month+1)/10)+day-1;w = (w%7+7)%7;return w;
}int mon[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
char s1[10],s2[10],s3[10];
int main()
{int x;scanf("%d%s%s",&x,s1,s3);if(s3[0]=='m'){int ans = 0;for(int i=1;i<=12;i++)if(mon[i]>=x)ans++;cout<<ans<<endl;}else{if(x==5||x==6)return puts("53");return puts("52");}
}

转载于:https://www.cnblogs.com/qscqesze/p/5091148.html

Codeforces Good Bye 2015 A. New Year and Days 水题相关推荐

  1. Codeforces Good Bye 2015 D. New Year and Ancient Prophecy 后缀数组 树状数组 dp

    D. New Year and Ancient Prophecy 题目连接: http://www.codeforces.com/contest/611/problem/C Description L ...

  2. Codeforces Round #370 (Div. 2) A. Memory and Crow 水题

    A. Memory and Crow 题目连接: http://codeforces.com/contest/712/problem/A Description There are n integer ...

  3. Codeforces Beta Round #14 (Div. 2) B. Young Photographer 水题

    B. Young Photographer 题目连接: http://codeforces.com/contest/14/problem/B Description Among other thing ...

  4. Codeforces Round #311 (Div. 2) A. Ilya and Diplomas 水题

    A. Ilya and Diplomas Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/ ...

  5. Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题

    A. Dasha and Stairs 题目连接: http://codeforces.com/contest/761/problem/A Description On her way to prog ...

  6. Codeforces Round #404 (Div. 2) B. Anton and Classes 水题

    B. Anton and Classes 题目连接: http://codeforces.com/contest/785/problem/B Description Anton likes to pl ...

  7. Codeforces Round #374 (Div. 2) A. One-dimensional Japanese Crosswor 水题

    A. One-dimensional Japanese Crossword 题目连接: http://codeforces.com/contest/721/problem/A Description ...

  8. Codeforces Round #358 (Div. 2) A. Alyona and Numbers 水题

    A. Alyona and Numbers 题目连接: http://www.codeforces.com/contest/682/problem/A Description After finish ...

  9. Codeforces Round #307 (Div. 2) A. GukiZ and Contest 水题

    A. GukiZ and Contest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/551/ ...

最新文章

  1. Angularjs与weui的握手
  2. 网易云信新增用户、IM、实时音视频多维度统计功能
  3. Modelsim command line 传参数到 .do 文件
  4. Android之支付宝设计与开发
  5. Grafana Prometheus 服务安装部署(Linux服务器监控)
  6. 敏捷开发生态系统系列之三:计划跟踪II(需求优先级排序-迭代期内无变更-团队承诺)...
  7. 计算机页面高度怎么设置方法,win10系统调节任务栏高度的设置技巧
  8. mysql解释命令,MySQL中EXPLAIN解释命令
  9. WireShark帧格式解析
  10. linux _max_path,[apue] Linux / Windows 系统上只能建立不超过 PATH_MAX / MAX_PATH 长度的路径吗?...
  11. 金融工程学(五):互换概述
  12. dvwa没有file1.php,文件包含漏洞-DVWA
  13. Python心法:numpy命令关于axis=0,axis=1,axis=2
  14. Mocking的概念及常见Mocking框架概述
  15. 【转】韩寒:跳出棋盘的棋子
  16. linux图形界面和dos界面切换
  17. win10光盘刻录linux镜像,解决win10系统刻录iso镜像系统光盘的技巧
  18. android锁死横竖屏,Android 锁定横竖屏
  19. 135编辑器图片裁切功能
  20. 用dd实现linux硬盘备份

热门文章

  1. 日志汇总:logging、logger
  2. AngularJS移动端页面input无法输入
  3. iOS 11: CORE ML—浅析
  4. java中sesion
  5. 使用Log4J监控系统日志邮件警报
  6. 一个自动生成关键字索引页面的比处理文件
  7. 推荐一篇讲解各种debug技术的文章,相当不错!
  8. media recovery oracle,Oracle非归档模式Media Recovery错误之--ORA-26040
  9. Mysql数据库查询当前操作的数据库名
  10. HTTP和HTTPS协议及工作原理分析