【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

闰,平,平
平,闰,平
平,平,闰
平,平,平
4种情况都考虑到就好。
可能有重复的情况。
但是没关系啦。

【代码】

#include <bits/stdc++.h>
using namespace std; const int N = 24;
int p[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
int r[12] = {31,29,31,30,31,30,31,31,30,31,30,31}; vector <int> v; void cl(int a[],int b[],int c[]){
v.clear();
for (int i = 0;i < 12;i++) v.push_back(a[i]);
for (int i = 0;i < 12;i++) v.push_back(b[i]);
for (int i = 0;i < 12;i++) v.push_back(c[i]);
} int n;
int a[N+10]; int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
for (int i = 1;i <= n;i++) cin >> a[i];
cl(r,p,p);
for (int i = 0;i < 36;i++)
{
int j = i+n-1;
if (j<36){
bool ok = true;
for (int k = i;k <= j;k++)
if (v[k]!=a[k-i+1]){
ok = false;
break;
}
if (ok){
cout <<"YES"<<endl;
return 0;
}
}
}
cl(p,r,p);
for (int i = 0;i < 36;i++)
{
int j = i+n-1;
if (j<36){
bool ok = true;
for (int k = i;k <= j;k++)
if (v[k]!=a[k-i+1]){
ok = false;
break;
}
if (ok){
cout <<"YES"<<endl;
return 0;
}
}
}
cl(p,p,r);
for (int i = 0;i < 36;i++)
{
int j = i+n-1;
if (j<36){
bool ok = true;
for (int k = i;k <= j;k++)
if (v[k]!=a[k-i+1]){
ok = false;
break;
}
if (ok){
cout <<"YES"<<endl;
return 0;
}
}
}
cl(p,p,p);
for (int i = 0;i < 36;i++)
{
int j = i+n-1;
if (j<36){
bool ok = true;
for (int k = i;k <= j;k++)
if (v[k]!=a[k-i+1]){
ok = false;
break;
}
if (ok){
cout <<"YES"<<endl;
return 0;
}
}
}
cout <<"NO"<<endl;
return 0;
}

【Codeforces Round #452 (Div. 2) B】Months and Years的更多相关文章

  1. 【Codeforces Round #452 (Div. 2) A】 Splitting in Teams

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 贪心 1优先和2组队. 如果1没有了 就结束. 如果1还有多余的. 那么就自己3个3个组队 [代码] #include <bi ...

  2. 【Codeforces Round #452 (Div. 2) C】 Dividing the numbers

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] n为偶数. l = 1, r = n (l,r)放在一组 l++,r-- 新的l,r放在另外一组 直到l+1==r 这个时候,判断两 ...

  3. 【Codeforces Round #452 (Div. 2) D】Shovel Sale

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 让N乘2->a 然后看一下位数是多少. 假设有x位(x>=2) 则(0..(a%10-1) ) + (99..9)[x- ...

  4. 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers

    [链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...

  5. 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes

    [题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...

  6. 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees

    [题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...

  7. 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory

    [题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...

  8. 【Codeforces Round #423 (Div. 2) C】String Reconstruction

    [Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...

  9. 【Codeforces Round #423 (Div. 2) B】Black Square

    [Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...

随机推荐

  1. vue.2.0-路由

    vue2.0 路由: http://router.vuejs.org/zh-cn/index.html 基本使用: 1. 布局 <router-link to="/home" ...

  2. 解决Maven项目相互依赖/循环依赖/双向依赖的问题

    转自:https://blog.csdn.net/leolu007/article/details/53079875 添加新随笔很​多​时​候​随​着​项​目​的​膨​胀​,模​块​会​越​来​越​多 ...

  3. JWT Authentication Tutorial: An example using Spring Boot--转

    原文地址:http://www.svlada.com/jwt-token-authentication-with-spring-boot/ Table of contents: Introductio ...

  4. Android控件-ViewPager(仿微信引导界面)

    什么是ViewPager? ViewPager是安卓3.0之后提供的新特性,继承自ViewGroup,专门用以实现左右滑动切换View的效果. 如果想向下兼容就必须要android-support-v ...

  5. 分享关于浏览器对象 history对象

    window.history.forward() == window.history.go(-1) //返回下一页 window.history.back() == window.history.go ...

  6. 学习参考《TensorFlow深度学习》高清中文版PDF+英文版PDF+源代码

    我们知道,TensorFlow是比较流行的深度学习框架,除了看手册文档外,推荐大家看看<Tensorflow深度学习>,共分5方面内容:基础知识.关键模块.算法模型.内核揭秘.生态发展.前 ...

  7. vue 常用ui组件库

    vux github ui demo:https://github.com/airyland/vux Mint UI 项目主页:http://mint-ui.github.io/#!/zh-cn de ...

  8. python 服务端判断客户端异常断开

    在进行 python 套接字编程时,服务端程序要判断客户端是否异常断开[由于断电或者其他突发情况导致链接中断],可以通过以下几种方式判断: 1.如果通信协议中,设有心跳包,则可记录上次收到时间,将服务 ...

  9. 关于mysql数据库在输入password后,滴的一声直接退出界面的解决的方法(具体办法)

    前一阵子.因为敲代码要用到数据库,便在本子上下载了一个,却出现非常多小问题(自己的台式机却没有该问题,可能是本人的本子太渣了吧),纠结了好一阵,回头想想.发现问题,分析问题,解决这个问题,不就是我们的 ...

  10. Thinkphp的 is null 查询条件是什么,以及exp表达式如何使用

    Thinkphp的 is null 查询条件是什么,以及exp表达式如何使用 一.总结 一句话总结:$map['name'] = array('exp','is null'); 1.is null判断 ...