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");
}
}

Codeforces Good Bye 2015 A. New Year and Days 水题的更多相关文章

  1. Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题

    除非特别忙,我接下来会尽可能翻译我做的每道CF题的题面! Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题 题面 胡小兔和司公子都认为对方是垃圾. 为了决出谁才是垃 ...

  2. Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题

    题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...

  3. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  4. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  5. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  6. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  7. Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题

    A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...

  8. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

  9. Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon 水题

    A. Watermelon 题目连接: http://www.codeforces.com/contest/4/problem/A Description One hot summer day Pet ...

随机推荐

  1. ERROR:The requested URL could not be retrieved解决方法

    ERROR 错误 The requested URL could not be retrieved 您所请求的网址(URL)无法获取 While trying to retrieve the URL: ...

  2. 数组名的含义.xml

    pre{ line-height:1; color:#1e1e1e; background-color:#f0f0f0; font-size:16px;}.sysFunc{color:#627cf6; ...

  3. jsoup入门

    官网地址:http://jsoup.org/ Jsoup是一个开源的Java库,它可以用于处理实际应用中的HTML.它提供了非常便利的API来进行数据的提取及修改,充分利用了 DOM,CSS以及jqu ...

  4. 苹果将通过新Apple TV打造电视游戏平台 欲发力家庭游戏(转)

    据<纽约时报>报道,9月10日凌晨1时举行的苹果发布会上将会公布新版Apple TV设备,还会推出TV版App Store.新设备以游戏作为主要卖点,图形性能将大幅提升. 苹果2015年秋 ...

  5. (转)log4j:WARN No appenders could be found for logger 解决方案

    我们在使用Log4j的时候,总是出现: log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.Log ...

  6. [Lua]入门教程

    什么是Lua Lua 是一个小巧的脚本语言.是巴西里约热内卢天主教大学(Pontifical Catholic University of Rio de Janeiro)里的一个研究小组,由Rober ...

  7. 开源框架DNN简介以及安装

    donetnuke 是一款免费的开源cms框架,目前也有收费版,不过免费版也可以适应大家大部分的需求.我前些阵子是老板让我在20天内,做好一个官网并且发布,并且指定使用dnn这个框架,考虑到又可以学习 ...

  8. HDU5874:Friends and Enemies

    题目链接: Friends and Enemies 分析: 是一道想法题,我们假设x个人互相敌对,然后有y个人与这x个人都是朋友,而这y个人互相敌对. 则有 x+y=m x*y<=n 举个例子: ...

  9. nodejs 调用 OC 方法

    nodejs 借助 nodobjc 模块 https://github.com/TooTallNate/NodObjC demo: var $ = require('nodobjc') $.frame ...

  10. *nix高手站点

    http://linux.die.net/man/7/ip http://www.neuma.com/  cm+企业开发生命周期管理 http://book.2cto.com/201307/27394 ...