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