不需要枚举月份啊,所有0结尾的月份改10,2结尾的月份全部改12(2除外),然后日期最多都是改一次的,所以判断是否合法就行了。
```cpp
#include<bits/stdc++.h>
using namespace std;
int ms[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int m,d,ans=0;
scanf("%02d-%02d",&m,&d);
if(m==0)m=1,ans++;
if(m>12)m=m%10+10*int(m%10==2||m%10==0),ans++;
if(d==0||d>ms[m])ans++;
cout<<ans;
}
```
by KnownError_ @ 2021-10-06 13:31:50