zoukankan      html  css  js  c++  java
  • 3.这个月有几天?

    时间限制: 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 ");

    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;

     

    }

  • 相关阅读:
    vpp编写plugin
    vrf 命令
    vxlan + 多个vrf
    dpdk helloworld
    Go函数高级
    Go_defer
    Go递归函数
    Go作用域
    Go函数
    Go字符串
  • 原文地址:https://www.cnblogs.com/csgc0131123/p/5290596.html
Copyright © 2011-2022 走看看