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. Android 异常捕获

    在用户使用APP时,如果APP毫无征兆的突然退出程序,又没有任何提示信息.我想这是一种最差劲的用户体验了吧,如果是我估计干脆就直接卸载APP了.因此,作为Android开发者对于这种情况的发生一定要有 ...

  2. SQL_从星期一到星期六自动打卡SQL代码

    create proc sp_MarkAutoKQ as begin ) ---创建两个变量,接收当前时间和当天是星期几 set @dateA=getdate() ---获取当前时间 set @dat ...

  3. sqlserver关于事务

    事务的四个特性: 原子性,一致性,持久性,隔离性 原子性: 原子性:表示事务执行是作为原子,不可分割,整个语句要么执行,要么不执行sqlserver中每一个单独的语句可以看做是包含在事务中每一句本身具 ...

  4. Mysql增加主键或者更改表的列为主键的sql语句

                                                                                                        ...

  5. 设置 MyEclipse 默认打开文件方式

         在web开发时,我们在打开JSP页面时,MyEclipse默认使用 Vistual 的方式打开.这种方式打开JSP页面时,很慢.在实际的开发过程中我们不想使用这种默认的方式打开JSP.设置如 ...

  6. OpenCV基本架构[OpenCV 笔记0]

    最近正在系统学习OpenCV,将不定期发布笔记,主要按照毛星云的<OpenCV3编程入门>的顺序学习,会参考官方教程和文档.学习工具是Xcode+CMake,会对书中一部分内容更正,并加入 ...

  7. extends 与 implements 的区别

    extends与implements是Java继承中使用的两个关键字,但extends与implements使用的情景不同: 1.接口继承接口,使用extends 2.类继承类时,用extends 3 ...

  8. input获取永久焦点

    $(function () { $('#test').blur(function () { var that = this; //或者用闭包 setTimeout(function () { $(th ...

  9. 怎么在spring官网上下载spring的jar包, 源代码和文档?

    现在 http://repo.spring.io/release/org/springframework/spring/第一种,简单粗暴直接 1 http://repo.springsource.or ...

  10. DIV当textarea使用,在聚焦的时候将光标移动到内容的末尾

    #### DIV当textarea使用,在聚焦的时候将光标移动到内容的末尾 #### <style type="text/css"> .test_box { width ...