1 条题解

  • -1
    #include <iostream>
    using namespace std;
    int year, month, day;
    int cnt(0);
    int test_day(const unsigned int &year, const unsigned int &month);
    
    int main()
    {
        cin>>year>>month>>day;
        while (cnt != 10000)
        {
            if (day == test_day(year, month))
            if (month == 12)
    {
            ++year;
            month = day = 1;
    }
    else
    {
        ++month;
        day = 1;
    }
        else
        ++day;
        ++cnt;
    }
        cout<<year<<"-"<<month<<"-"<<day;
        return 0;
    }
    
    int test_day(const unsigned int &year, const unsigned int &month)
    {
        if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
        return 31;
        if (month == 2)
        return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28;
        return 30;
    }
    
    
  • 1

信息

ID
1139
难度
5
分类
模拟 点击显示
标签
(无)
递交数
226
已通过
86
通过率
38%
上传者