@[Wangcanyuan](/user/1062722)
This is my code(language is C++),you ke yi kan yi kan:
```
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define LG086 signed
#define END() return 0;
#define MIN -1145141919810
#define MAX 1145141919810
using namespace std;
int read(){
int w=0,f=0;
char c=getchar();
while(~c&&!isdigit(c))f|=c== '-',c=getchar();
while(isdigit(c))w=(w<<1)+(w<<3)+(c^48),c=getchar();
return f?-w:w;
}
void write(int x){
if(x<0)putchar('-'),x=-x;
static int stc[40];int top = 0;
do stc[++top]=x%10,x/=10;while(x);
while(top)putchar(stc[top--]|48);
}
int a=read(),b=read(),f;
int m[1145]={0,31,28,31,30,31,30,31,31,30,31,30,31};
LG086 main(){
if(a==0){
if(b<=31&&b!=0)return cout<<1,0;
else return cout<<2,0;
}
if(a<=12){
if(b==0)f++,b=1;
if(b>m[a])f++,b=b%10;
}
if(a>12){
if(b==0)f++,b=1;
if(b<=m[a/10]||b<=m[a%10]||(a%10<=2&&b<=m[a%10+10]))f++;
else f+=2,a=1;
}
cout<<f;
}
```
This is you code.I gai guo le:
```cpp
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a,b,z;
signed main(){
scanf("%lld-%lld",&a,&b);
if(a<1){//特判
z++;
if(b>31||b<1)z++,b=1;
//原来输入 00-35 你会输出1;其实因该输出2.
}
if(a>12&&a%10==2&&b<=31&&b!=0)a=12,z++;//如果a的个位为2且b<=31不为0可以变为12而不是2.
if(a>12){
z++;
a%=10;
if(a==0)a=10;
}
if(a==2&&(b<0||b>28))z++;
if((a==1||a==3||a==5||a==7||a==8||a==10||a==12)&&(b<=0||b>31))z++;
if((a==4||a==6||a==9||a==11)&&(b<=0||b>30))z++;//去掉多余的2月
cout<<z;
return 0;
}
```
by LG086 @ 2024-07-29 21:56:50
@[LG086](/user/1159764) thanks
by Wangcanyuan @ 2024-07-29 22:03:06