80分求助,#1,#7
查看原帖
80分求助,#1,#7
838964
JCY___楼主2023/10/8 16:30
#include<bits/stdc++.h>
using namespace std;
string s;
int y,r,cnt;
int main(){
	cin>>s;
	y=s[1]-'0'+(s[0]-'0')*10;
	r=s[4]-'0'+(s[3]-'0')*10;
	if(y>12||y==0) cnt++;
	if((y==1||y==3||y==5||y==7||y==8||y==10||y==12)&&(r>31||r==0)) cnt++;
	else if(y==2&&r>28) cnt++;
	else if((y==4||y==6||y==9||y==11)&&(r>30||r==0)) cnt++;
	cout<<cnt;
	return 0;
}

谢谢

2023/10/8 16:30
加载中...