题解
2023-06-27 16:35:51
发布于:上海
55阅读
0回复
0点赞
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
const int N=1e5+4,inf=2147483647;
int a[N];
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int n,x,y,z,cnt;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
x=1;
while(a[x]!=2&&x<=n)x++;
while(a[x]!=0&&x<=n)x++;
while(a[x]!=2&&x<=n)x++;
while(a[x]!=3&&x<=n)x++;
if(x>n-4){
printf("0\n");
return 0;
}
x++;
for(int i=1;i<=12;i++){
y=x;
while(a[y]!=i/10&&y<=n)y++;
y++;
while(a[y]!=i%10&&y<=n)y++;
if(y<=n-2){
y++;
for(int j=1;j<=m[i];j++){
z=y;
while(a[z]!=j/10&&z<=n)z++;
z++;
while(a[z]!=j%10&&z<=n)z++;
if(z<=n)cnt++;
}
}
}
printf("%d\n",cnt);
return 0;
}
这里空空如也
有帮助,赞一个