8 条题解

  • 0
    @ 2024-8-11 17:20:37

    // 处理每个月的天数 int days_in_month;

    switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: days_in_month = 31; break; case 4: case 6: case 9: case 11: days_in_month = 30; break; case 2: // 判断是否是闰年 if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { days_in_month = 29; } else { days_in_month = 28; } break; default: days_in_month = 0; // 无效的月份 break; }

    printf("%d\n", days_in_month); return 0;

    信息

    ID
    43
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    4495
    已通过
    1222
    上传者