博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Good Bye 2015 A. New Year and Days 水题
阅读量:5125 次
发布时间:2019-06-13

本文共 1683 字,大约阅读时间需要 5 分钟。

A. New Year and Days

题目连接:

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

转载于:https://www.cnblogs.com/qscqesze/p/5091148.html

你可能感兴趣的文章
(tmp >> 8) & 0xff;
查看>>
linux命令之ifconfig详细解释
查看>>
NAT地址转换
查看>>
Nhibernate 过长的字符串报错 dehydration property
查看>>
Deque - leetcode 【双端队列】
查看>>
Linux 普通用户拿到root权限及使用szrz命令上传下载文件
查看>>
人物角色群体攻击判定(一)
查看>>
JavaWeb学习过程 之c3p0的使用
查看>>
MySql Delimiter
查看>>
一步步学习微软InfoPath2010和SP2010--第九章节--使用SharePoint用户配置文件Web service(2)--在事件注册表单上创建表单加载规则...
查看>>
使用客户端对象模型读取SharePoint列表数据
查看>>
POJ 1328 Radar Installation 贪心
查看>>
gulp插件gulp-ruby-sass和livereload插件
查看>>
单元测试原来是这样的呼
查看>>
java定时任务详解
查看>>
IOS之导航控制器与表视图
查看>>
MSYS2使用教程
查看>>
Hadoop 配置文件 & 启动方式
查看>>
2016年4月 之 《C程序设计语言》
查看>>
WCF配置报错 在 ServiceModel 客户端配置部分中,找不到名称 和协定
查看>>