Good Bye 2015 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.
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.
Print one integer — the number of candies Limak will save in the year 2016.
4 of week
52
30 of month
11
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 签到的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- codeforces Good Bye 2015 B. New Year and Old Property
题目链接:http://codeforces.com/problemset/problem/611/B 题目意思:就是在 [a, b] 这个范围内(1 ≤ a ≤ b ≤ 10^18)统计出符合二进制 ...
- Good Bye 2015 C. New Year and Domino 二维前缀
C. New Year and Domino They say "years are like dominoes, tumbling one after the other". ...
- 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 ...
- 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 ...
随机推荐
- android开发系列之友盟统计集成
相比大家都遇到这种情况,当我们的app上线之后,我们想要实时的跟踪了解到app里面的bug情况.新增用户情况.用户相关的行为属性情况等.但是如果自己在app里面去开发集成这些功能,一方面开发工作量还挺 ...
- sql语句查询经纬度范围
指定一个经纬度,给定一个范围值(单位:千米),查出在经纬度周围这个范围内的数据. 经度:113.914619 纬度:22.50128 范围:2km longitude为数据表经度字段 latitude ...
- 基于perl的网络爬虫
use Mojo::UserAgent; use Bloom::Filter; use Smart::Comments; use DBI; my $dbname = "bbs_url&quo ...
- UIImagePickerController之Block回调
方法使用:引入头文件 #import "UIImagePickerController+Block.h" 我这拖出来的两个属性 @property (weak, nonatomic ...
- LinqToExcel: LINQ查询Excel电子表格
Linq的强大人所共知,能不能将Linq扩展到读取excel呢? 答案当然是肯定的. LinqToExcel就是一个实现了使用Linq语法查询excel表格的.net开源类库. 在nuget搜索下载安 ...
- P3380: [Usaco2004 Open]Cave Cows 1 洞穴里的牛之一
还是蛮简单的一道题,首先dfs一遍,在所有能到达放有干草的洞穴的所有路径中,找出路径上最小伐值的最大值,按这个值由小到大,再来一遍贪心就行了,能放就放,不能放拉倒(也可以理解为,不能放把最前一个删了) ...
- ##常用效果css##
1 绝对定位的元素的位置相对于最近的已定位祖先元素,如果元素没有已定位的祖先元素,那么它的位置相对于最初的包含块.元素被设置成,absolute,原有的位置会被占用,设为 relative原位置 ...
- 【收藏】Linux添加/删除用户和用户组
1.建用户: adduser phpq //新建phpq用户 passwd phpq ...
- 基于AutoCAD的空间数据共享平台雏形
好久没有更新博客了,今天先透露一个新的产品——AutoMap.我自己对于这个产品的定位是“基于AutoCAD的空间数据共享平台”.用一句话来概括AutoMap的功能:为用户提供一个在AutoCAD下访 ...
- 在C#中创建word文档
在下面文档中 首先引用word组件:Microsoft.Office.Interop.Word 在头文件中写上 using Word = Microsoft.Office.Interop.Word; ...