求助!c++60分
查看原帖
求助!c++60分
789654
jasonshen_楼主2023/3/12 12:00
#include <bits/stdc++.h>

using namespace std;
int pd(int a){
	if(a==1||a==3||a==5||a==7||a==8||a==10|a==11){
		return 31;
	}
	if(a==4||a==6||a==9||a==12){
		return 30;
	}
	if(a==2){
		return 28; 
	}
} 
int pd2(int b){
if(b==1||b==3||b==5||b==7||b==8||b==10|b==11){
		return 31;
	}
	if(b==4||b==6||b==9||b==12){
		return 30;
	}
	if(b==2){
		return 29; 
	}	
}
bool pr(int c){
	if(c%100==0){
		if(c%400==0){
			return true;
		}else{
			return false;
		}
		
	}else{
		if(c%4==0){
			return true;
		}else{
			return false;
		}
	}

}
int main()
{
int a,b;
cin>>a>>b;
int q=pr(a);
if(q==0){
	cout<<pd(b);
}else{
	cout<<pd2(b);
}
}

第一个和第五个过不去QAQ

2023/3/12 12:00
加载中...