时间限制: 1 s
 空间限制: 1000 KB

    题目描述 Description

    输入一个年代和一个月份,打印该月的天数

    输入描述 Input Description

    一个年代和一个月份

    输出描述 Output Description

    该月的天数

    样例输入 Sample Input

    2013 1

    样例输出 Sample Output

    31

    数据范围及提示 Data Size & Hint

    注意平年闰年

    源代码如下:

    #include

    using namespace std;

    #include

    int main()

    {

    int year,mou;

    cin>>year>>mou;

    if(mou==1||mou==3||mou==5||mou==7||mou==8||mou==10||mou==12)

    {

    printf("31\n");

    return 0;

    }

    if(year0!=0&&year%4==0&&mou==2)

    {

    cout<<29<<endl;return 0;

     

    }

    if(year@0==0&&mou==2)

    {

    cout<<29;

    return 0;

    }

    if(mou==2)

    cout<<28;

    if(mou==4||mou==6||mou==11||mou==9)

    {

    cout<<30<<endl;

    return 0;

    }

    return 0;

     

    }

    相关文章:

    • 2022-01-31
    • 2022-12-23
    • 2022-12-23
    • 2022-01-22
    • 2022-12-23
    • 2022-02-06
    • 2021-12-22
    • 2022-12-23
    猜你喜欢
    • 2022-02-01
    • 2021-04-17
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    相关资源
    相似解决方案