A. New Year 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.

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.

 题意:  x of week"   算出2016中有几个星期x

"x of month"  算出2016 中 有几个 每个月第x天

题解:

吧每个月的天数写出来,。。。。

//meek
#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include<map>
using namespace std ;
typedef long long ll;
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define fi first
#define se second
#define MP make_pair const int N=+;
const ll INF = 1ll<<;
const int inf = ;
const int MOD= ; int s[] = {,,,,,,,,,,,};
char a[],b[];
int main() {
int sum = ,ans=,n;
for(int i=;i<;i++) sum+=s[i];
scanf("%d%s%s",&n,a,b);
if(b[] == 'w') {
int f = ;
for(int i=;i<=sum;i++) {
if(f==n) ans++;
f++;
if(f==) f=;
}
cout<<ans<<endl;
}
else {
if(n<=) cout<<<<endl;
else if(n==) cout<<<<endl;
else cout<<<<endl;
}
return ;
}

代码

Good Bye 2015 A. New Year and Days 签到的更多相关文章

  1. Good Bye 2015 D. New Year and Ancient Prophecy

    D. New Year and Ancient Prophecy time limit per test 2.5 seconds memory limit per test 512 megabytes ...

  2. Good Bye 2015 B. New Year and Old Property 计数问题

    B. New Year and Old Property   The year 2015 is almost over. Limak is a little polar bear. He has re ...

  3. Codeforces Good bye 2015 B. New Year and Old Property dfs 数位DP

    B. New Year and Old Property 题目连接: http://www.codeforces.com/contest/611/problem/B Description The y ...

  4. Codeforces Good Bye 2015 A. New Year and Days 水题

    A. New Year and Days 题目连接: http://www.codeforces.com/contest/611/problem/A Description Today is Wedn ...

  5. Good Bye 2015 B. New Year and Old Property —— dfs 数学

    题目链接:http://codeforces.com/problemset/problem/611/B B. New Year and Old Property time limit per test ...

  6. codeforces Good Bye 2015 B. New Year and Old Property

    题目链接:http://codeforces.com/problemset/problem/611/B 题目意思:就是在 [a, b] 这个范围内(1 ≤ a ≤ b ≤ 10^18)统计出符合二进制 ...

  7. Good Bye 2015 C. New Year and Domino 二维前缀

    C. New Year and Domino   They say "years are like dominoes, tumbling one after the other". ...

  8. 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 ...

  9. Codeforces Good Bye 2015 C. New Year and Domino 前缀和

    C. New Year and Domino 题目连接: http://www.codeforces.com/contest/611/problem/C Description They say &q ...

随机推荐

  1. 请输入正确的RSA公钥

    没啥原因,换个浏览器就好使,原因是现有窗口登陆超时了.

  2. web安全之token

    Token,就是令牌,最大的特点就是随机性,不可预测.一般黑客或软件无法猜测出来. 那么,Token有什么作用?又是什么原理呢? Token一般用在两个地方: 1)防止表单重复提交. 2)anti c ...

  3. 使用NPOI完成导出Excel文件

    参考网址:http://blog.csdn.net/tiemufeng1122/article/details/6732588 能够实现  点击按钮弹出下载框    的功能,如图: HTML代码: & ...

  4. Java实现Socket之WhoisClient

    Java实现Socket之WhoisClient 代码内容 从常用的whois服务器的43号端口得到对应域名的所有注册信息并显示出来 代码实现 /* WhoisClient.java */ impor ...

  5. c++中-1是true呢还是false呢

    今天想看一下引用c++中的,然后看到网上有问c++中-1是true or false呢?用vc6.0是了一下,是true.vc6.0中应该是非0的都是true,0为false.java我也试了一下,i ...

  6. mysql死锁示例

    MySQL有三种锁的级别:页级.表级.行级. MyISAM和MEMORY存储引擎采用的是表级锁(table-level locking):BDB存储引擎采用的是页面锁(page-level locki ...

  7. ERP系统实施与企业内部控制管理实践

    COSO内部控制体系包含5 个要素,分别为控制环境.风险评估.控制活动.信息与沟通.监督,涉及公司层面的控制.业务活动的控制以及信息系统总体控制.随着ERP系统的上线运行,企业的内部控制体系建设应与E ...

  8. Eclipse的python插件安装

    网上找了一些资料都没有成功~~然后自己装的过程中编辑记录了一些 当然博客园里也有人用这一种方法也可以参考IBM中的 http://www.cnblogs.com/visec479/p/4139882. ...

  9. android开发 实现同时显示png/jpg 等bitmap图片还可以显示gif图片,有效防止OOM

    本来使用第三方jar包 GifView.jar  发现使用的时候不能显示png图片,而且多次setgifimage的时候还会OOM: 现在使用了一个新的第三方,demo是别人的, 下载链接:http: ...

  10. Ext.Ajax中scope的作用

    在Ext的前台Js中使用Ajax请求,如果想让回调函数中的this作用域跟当前的类一样如何实现呢?Ajax提供了一个参数scope. 详细代码如下: layout : { type : 'accord ...