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. linux umask使用详解

    转自:http://blog.csdn.net/lmh12506/article/details/7281910 umask使用方法 A 什么是umask?   当我们登录系统之后创建一个文件总是有一 ...

  2. $(document).ready()并不靠谱

    好多用过jQuery的朋友都为jQuery的强大功能和易用性折服,有了jQuery菜鸟也能做javascript特效,有了jQuery高手写代码的效率会进一步提升. 学习jQuery的第一课就是学会在 ...

  3. eclipse 文本编辑器

    Eclipse文本编辑器拥有编辑器的标准功能,包括数目不限的Undo(Ctrl+Z)和Redo(Ctrl+Y)操作.使用快捷键Ctrl+F后,会出现Find/Replace对话框,快捷键Ctrl+K或 ...

  4. ps闪闪发光的字 教程+自我练习

    本教程的文字效果非常经典.不仅是效果出色,创作思路及制作手法都堪称完美.作者并没有直接使用纹理素材,纹理部分都是用滤镜来完成.这需要很强的综合能力,非常值得学习和借鉴.最终效果 我的: 1.创建一个新 ...

  5. HDU-3401 Trade 单调队列优化DP

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3401 DP方程容易想出来,f[i][j]表示第i天拥有j个股票的最优解,则: 1.不买不卖,f[i][ ...

  6. 监听mysql是否挂了

    监听mysql是否挂了,如果挂了就重启mysql 方式一: #!/bin/bash pgrep -x mysqld &> /dev/null if [ $? -ne 0 ] then e ...

  7. 第三百四十六天 how can I 坚持

    徐斌的电脑来了,thinkpad,感觉还好,电脑也就这样,联想..不好说,不做评论,末日王者吧. 为什么写博客tab键不管用了呢. 下午又去奥体跑了一圈,好累,刚跑完腿疼,现在还好. 还没洗澡呢,都这 ...

  8. Ubuntu 14.04 LTS中怎样解决系统设置残缺的问题

    iBus卸载之后,系统设置会缺失,是Ubuntu 14.04和iBus之间的关系引起的,但是如果直接安装 sudo apt-get install ubuntu-desktop 这个会把amazon广 ...

  9. HDU 2196Computer(树形DP)

    给你一颗边带权值的树,求树上的每一点距离其最远的一个点的距离 比较典型的题了,主要方法是进行两次DFS,第一次DFS求出每一个点距离它的子树的最远距离和次远距离,然后第二次DFS从父节点传过来另一侧的 ...

  10. UVaLive 6693 Flow Game (计算几何,线段相交)

    题意:给个棋盘,你可以在棋盘的边缘处放2个蓝色棋子2个黄色棋子,问连接2组同色棋子的最小代价,如果线路交叉,输-1. 析:交叉么,可以把它们看成是两条线段,然后如果相交就是不行的,但是有几种特殊情况, ...