TLE了!!!
查看原帖
TLE了!!!
1221293
franking楼主2025/1/20 22:32

超时求大佬调!!!

#include<iostream>
using namespace std;
int year,month;
int Is(int n){
	if(n%4==0&&n%100!=0)
	{
		return 1;
	}else if(n%400==0)
	{
		return 1;
	}else{
		return 0;
	}
}
int HowDay(int a,int b){
	if(Is(a)==1&&b==2)
	{
		cout<<"29";
	}else if(Is(a)==0&&b==2)
	{
		cout<<"28";
	}else if(b%2==1||b==8){
		cout<<"31";
	}else{
		cout<<"30";
	}
}
int main(){
	cin>>year>>month;
	HowDay(year,month);
}


2025/1/20 22:32
加载中...