简简单单
2024-08-15 15:27:55
发布于:浙江
1阅读
0回复
0点赞
#include <iostream>
using namespace std;
bool isLeapYear(int year) {
return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
int main() {
int year, month;
cin >> year >> month;
if (month == 2) {
cout << (isLeapYear(year) ? 29 : 28) << endl;
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
cout << 30 << endl;
} else {
cout << 31 << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个