题意:
判断给你的序列,能不能在现实的月的天数里找到。
POINT:
当心闰年不可能连续两年就行。
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <vector>
#include <map>
#include <stdio.h>
#include <algorithm>
using namespace std;
int n;
int a[3];
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int aim[33];
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>aim[i];
}
int flag=0;
int f=0;
for(int i=1;i<=12;i++){
int len=1;
while(len<=n){
int to=i+len-1;
while(to>=13) to-=12;
if(to==2){
if(aim[len]==29&&f==0){
f=1;
len++;
continue;
}
if(aim[len]==28){
len++;
continue;
}
}
if(aim[len]==m[to]){
len++;
continue;
}
break;
}
if(len==n+1){
flag=1;
break;
}
}
if(flag) printf("YES\n");
else printf("NO\n");
}