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 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 水题的更多相关文章
- Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题
除非特别忙,我接下来会尽可能翻译我做的每道CF题的题面! Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题 题面 胡小兔和司公子都认为对方是垃圾. 为了决出谁才是垃 ...
- Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题
题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...
- 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 ...
- 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 ...
- Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Yii入门教程
1准备Yii源码 首先新建helloyii目录作为Web应用的根目录,并添加到Nginx的配置文件中.然后将Yii框架源码部署到helloyii下,目录结构如下: helloyii/ |-- fram ...
- Jquery图片随滚动条加载
很久以前的写的Jquery图片随滚动条加载,现在不是什么新技术,应用也很广泛,大大提高图片多的页面打开速度! 有需要的朋友看看吧!有什么意见或建议欢迎留言交流! Demo.html 源码: < ...
- python 安装预编译库注意事项-pip
一般安装依赖库用pip install 库名 就可以,某些情况下依赖的库需要安装预编译好的, 可以参考pip 安装时的错误信息 下面这个链接中可以直接下载 http://www.lfd.uci.edu ...
- C++ 容器一些细节
今天学习是看到了讲解C++容器的一些细节用法,故记之!参考:http://www.cnblogs.com/answeryi/archive/2011/12/16/2289811.html: 目录 == ...
- Mapreduce读取Hbase表,写数据到一个Hbase表中
public class LabelJob { public static void main(String[] args) throws Exception { Job job = Job.getI ...
- 上传控件swfupload的使用笔记
1.下载下来的官方domo里不同的例子里会引入各自的JS,注意区分.可以直接拿官方例子来改成自己想要的例子. 2.注意PHP配置文件里也有最大上传文件限制,如果文件太大会上传不成功. 3.如果有问题可 ...
- junit4新框架hamcrest
Hamcrest是一个书写匹配器对象时允许直接定义匹配规则的框架.有大量的匹配器是侵入式的,例如UI验证或者数据过滤,但是匹配对象在书写灵活的测试是最常用.本教程将告诉你如何使用Hamcrest进行单 ...
- eCryptfs文件系统测试
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" ...
- SQL 脚本
1.USE语句 USE语句用于设置当前数据库,如果没有USE语句,那么就由执行脚本的任何用户来确定执行脚本时当前数据库是正确的.如果只是一个通用脚本,那么省去USE语句实际上可能更有益.通常,如果在脚 ...
- Struct2提交表单数据到Acion
Struct2提交表单数据到Action,Action取表单的数据,传递变量.对象 HTML.jsp <form action="reg.do" method="p ...