天数解说
2026-09-11 13:12:10
发布于:广东
1阅读
0回复
0点赞
很简单,就是有点长,ac就行。
#include<iostream>
using namespace std;
int main()
{
int year, month;
cin >> year >> month;
int x1=31;
int x2=28;
int x3=31;
int x4=30;
int x5=31;
int x6=30;
int x7=31;
int x8=31;
int x9=30;
int x10=31;
int x11=30;
int x12=31;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
x2=29;
}
switch (month){
case 1:cout<<x1;break;
case 2:cout<<x2;break;
case 3:cout<<x3;break;
case 4:cout<<x4;break;
case 5:cout<<x5;break;
case 6:cout<<x6;break;
case 7:cout<<x7;break;
case 8:cout<<x8;break;
case 9:cout<<x9;break;
case 10:cout<<x10;break;
case 11:cout<<x11;break;
case 12:cout<<x12;break;
}
return 0;
}
这里空空如也






有帮助,赞一个