全部评论 1

  • #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;
    }

    2024-08-15 来自 浙江

    0
首页