Problem A:http://codeforces.com/problemset/problem/611/A

A. New Year and Days

题意:某人要在2016年收集糖果,有两种不同的收集方式,按week或month。x表示week的周x或月的x号,只有到每周或每月的x时才会收集一颗糖果,问:在给定的月或周条件内,2016年能收集多少颗糖果。

思路:我是用数组存好,其实也可以更简洁,周的话除了5,6,7是53个,其他都是52个;月的话1-29都是12(闰年),30是11,31是7;

#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main(){
int a[]={,,,,,,,};
int n,l;
string s1,s2;
cin>>n>>s1>>s2;
l=s2.length() ;
if(l==)
printf("%d\n",a[n]);
else if(l==){
if(n<=)
printf("12\n");
if(n==)
printf("11\n");
if(n==)
printf("7\n");
}
return ;
}

Good Bye 2015 A的更多相关文章

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

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

  3. Good Bye 2015 A. New Year and Days 签到

    A. New Year and Days   Today is Wednesday, the third day of the week. What's more interesting is tha ...

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

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

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

  7. codeforces Good Bye 2015 B. New Year and Old Property

    题目链接:http://codeforces.com/problemset/problem/611/B 题目意思:就是在 [a, b] 这个范围内(1 ≤ a ≤ b ≤ 10^18)统计出符合二进制 ...

  8. Good Bye 2015 C. New Year and Domino 二维前缀

    C. New Year and Domino   They say "years are like dominoes, tumbling one after the other". ...

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

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

随机推荐

  1. 在Delphi中,关于数组名称

    动态数组数组名代表的是第一个元素的内存地址. 静态数组名称代表的是数组第一个元素的内存位置, 而不是数组第一个元素的内存地址. 但对于静态数组,在某些情况下编译器可能会自动取数组地址,如: funct ...

  2. Fragment 整个生命周期

      时间 2014-05-21 17:09:53 CSDN博客原文 http://blog.csdn.net/linfeng24/article/details/26491407 Fragment 生 ...

  3. 第七篇、微信小程序-video组件

    主要属性: 效果图: ml: <View>1.播放网络视频</View> <view > <video style="width: 100%;hei ...

  4. bzoj3405:[Usaco2009 Open]Grazing2 移动牛棚

    思路:首先因为要让距离尽量大,所以奶牛1一定在1号牛棚,奶牛n一定在s号牛棚,然后考虑dp. 因为总距离为s-1,然后要使长度为d的段数尽量多,那么剩下的一定就是d+1的段数,也就是s-(n-1)*d ...

  5. undrop for innodb c_parser 不完美之处

    今天发现c_parser导出数据是会丢掉某些行,给过调试发现是他处理utf8编码时计算有误,目前还没有发现自动解决总是的方法,只会手动改代码来解决. 下一步计划把c_parser移植到windows下 ...

  6. COM原理

    1, 进程内组件:服务程序杯加载到客户的进程空间,通常是DLL的形式.本地组件:服务程序与与客户程序在同一台电脑上,通常是EXE.远程组件: 服务程序与与客户程序在不同的电脑上,可以是DLL模块也可是 ...

  7. C++对象的JSON序列化与反序列化探索续-复杂对象的序列化与反序列化

    本文是基本上一篇博文进行改进而成,上一篇请见: C++对象的JSON序列化与反序列化探索 此处就不多说了,直接上代码. 1. 序列化基类 #pragma once #include <strin ...

  8. Poj 3982 序列

    1.Link: http://poj.org/problem?id=3982 2.Content: 序列 Time Limit: 1000MS   Memory Limit: 65536K Total ...

  9. 【oracle】Enterprise Manager 无法连接到数据库实例。下面列出了组件的状态---个人解决方案

    最近在学习Oracle,平常喜欢使用EM查看数据库状态,但是在最近突然发现EM连接不上Oracle数据库了,不知道问题出在哪里,只好卸载了重装.但是,在使用了几天以后,又出现了相同的问题,于是下决心将 ...

  10. php curl基本操作

    如何使用cURL的基本方法?首先,修改php.ini文件的设置,找到php_curl.dll,取消下在的注释extension=php_curl.dll,因为php默认是不开启cURL的. cURL是 ...