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. 最简单的耗时组件(窗口activity里面放一个progressBar)

    ①.先定义一个activity package com.example.administrator.actionbardemo; import android.app.Activity; import ...

  2. Ubuntu14.04 Objective-C hello world

    1. Install GNUstep sudo apt-get install gnustep gnustep-devel 2. Write hello world program, and save ...

  3. Windows 10 IoT Core Samples

    Windows 10 IoT Core Samples Welcome to the Windows 10 IoT Core Samples These samples have been valid ...

  4. squid基础配置

    1 2 3 4 5 6 7 8 9 10 vim /etc/squid/squid.conf    http_port 192.168.1.12:3128 (可写多个) cache_mem 64MB  ...

  5. [转]WinExec、ShellExecute和CreateProcess及返回值判断方式

    [转]WinExec.ShellExecute和CreateProcess及返回值判断方式 http://www.cnblogs.com/ziwuge/archive/2012/03/12/23924 ...

  6. Linux C 文件与目录4 将缓冲区数据写入磁盘

    将缓冲区数据写入磁盘 所谓缓冲区,是Linux系统对文件的一种处理方式.在对文件进行写操作时,并没有立即把数据写入到磁盘,而是把数据写入到缓冲区.如果需要把数据立即写入到磁盘,可以使用sync函数.用 ...

  7. cocos2dx 3.x中的渲染机制

    1.由2.x的渲染节点,变成添加渲染命令,可以避免重复渲染相同的节点,提高了渲染效率 2.单机游戏通常要求apk包在30M以内,没压缩1M会有1%的转换率(下载转换率),即收入会提高 3.2.x中首先 ...

  8. 项目中添加Log4J支持

    首先,在项目中的classes 中新建立一个log4j.properties文件即可: 在实际编程时,要使Log4j真正在系统中运行事先还要对配置文件进行定义.定义步骤就是对Logger.Append ...

  9. Log4j的常见用法

    对于log4j,一般常用的只要保存如下的内容为属性文件即可: #log4j.rootLogger=DEBUG,A1,R log4j.rootLogger=INFO,A1,R log4j.appende ...

  10. 四则运算出题器(C++)-BUG修复

    定制题目数量这个功能测试: (1)输入题目数为负数时: 可正确处理: (2)输入题目数量为0时: 可正确处理: (3)输入题目数量为小数时: 程序运行出错: 错误分析: 因为代码中题目数量的变量Que ...