题目描述
输入年份和月份,输出这一年的这一月有多少天。需要考虑闰年。
输入格式
无
输出格式
无
输入输出样例
输入 #1 复制
1926 8
输出 #1 复制
31
输入 #2 复制
2000 2
输出 #2 复制
29
#include<iostream>
using namespace std;
int main(){
int year,month;
cin>>year>>month;
switch(month){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
cout<<31;
break;
case 4:
case 6:
case 9:
case 11:
cout<<30;
break;
case 2:
if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
cout<<29;
}
else{
cout<<28;
}
}
return 0;
}