#include <iostream>
using namespace std;
int year, month;
bool is_run(int year) {
if (year % 100 == 0) {
if (year % 400 == 0)return true;
else return false;
}
else if (year % 4 == 0)return true;
else return false;
}
int main() {
cin >> year >> month;
if (month == 2) {
if (is_run(year)) cout << "29";
else cout << "28";
}
else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)cout << "31";
else cout << "30";
}
1016. 计算天数 (Standard IO)
最新推荐文章于 2024-07-11 13:30:38 发布