#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int a[100],p[20240000];
int ans;
bool check(int data){
int riqi[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int y=data/10000;
//cout<<y<<endl;
int m=(data%10000)/100;
//cout<<m<<endl;
int d=data%100;
//cout<<d<<endl;
if(y!=2023)return false;
//cout<<"到这里了"<<endl;
if(m<=0||m>12)return false;
//cout<<"到这里了2"<<endl;
if(d<=0||d>riqi[m]){
return false;
}
return true;
//cout<<"到这里了3"<<endl;
}
void dfs(int pos,int data,int x){//pos是8位数中的第几位,data是8位数是多少,x是数组中的第几个
//cout<<"data="<<data<<endl;
//cout<<"pos="<<pos<<endl;
//cout<<"x="<<x<<endl;
if(p[data])return;
// if(pos==8&&check(data)){
// cout<<"进来了"<<endl;
// p[data]=1;
// ans++;
// return;
// }else if(pos==8&&!check(data))return;
if(pos==8){
if(check(data)){
p[data]=1;
ans++;
return;
}
return;
}
if(x==100)return;
// if((pos==0&&a[x]==2)||
// (pos==1&&a[x]==0)||
// (pos==2&&a[x]==2)||
// (pos==3&&a[x]==3)||
// (pos==4&&0<=a[x]&&a[x]<=1)||
// (pos==5&&0<=a[x]&&a[x]<=9)||
// (pos==6&&0<=a[x]&&a[x]<=3)||
// (pos==7&&0<=a[x]&&a[x]<=9)){
// dfs(pos+1,data*10+a[x],x+1);
// }
// else {
// dfs(pos,data,x+1);//else 就是只会处理if或者else中的一次
// }
if ((pos == 0 && a[x] == 2) ||
(pos == 1 && a[x] == 0) ||
(pos == 2 && a[x] == 2) ||
(pos == 3 && a[x] == 3) ||
(pos == 4 && 0 <= a[x] && a[x] <= 1) ||
(pos == 5 && 0 <= a[x] && a[x] <= 9) ||
(pos == 6 && 0 <= a[x] && a[x] <= 3) ||
(pos == 7 && 0 <= a[x] && a[x] <= 9)) {
dfs(pos + 1, data * 10 + a[x], x + 1);
}
// 考虑不使用当前数字
//else 就是只会处理if或者else中的一次 ,去掉else就是不管如何都会执行 dfs(pos, data, x + 1);
dfs(pos, data, x + 1);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for(int i=0;i<100;i++)cin>>a[i];
//for(int i=0;i<100;i++)cout<<a[i]<<" ";
dfs(0,0,0);//一个是8位数值,一个是在数组中的位置,一个这个8位数的位置
cout<<endl;
cout<<ans<<endl;
// if(check(20230228))cout<<"对了"<<endl;
return 0;
};
/*
5 6 8 6 9 1 6 1 2 4 9 1 9 8 2 3 6 4 7 7 5 9 5 0 3 8 7 5 8 1 5 8 6 1 8 3 0 3 7 9 2
7 0 5 8 8 5 7 0 9 9 1 9 4 4 6 8 6 3 3 8 5 1 6 3 4 6 7 0 7 8 2 7 6 8 9 5 6 5 6 1 4 0 1
0 0 9 4 8 0 9 1 2 8 5 0 2 5 3 3
*/
例如我们要求a,dfs()递归的函数中,要传递的参数,分别是(1).a的变化情况,(2)就是处理到递归中的哪个位置,如果是在二维数组中就是看处理到二维数组的的哪个位置,如果是在数组中递归,就看递归到数组的哪一个地方(3)或者就是看递归到第几位