zoukankan      html  css  js  c++  java
  • 第几天?(hdu2005)

    第几天那个代码模板可以保存起来。

    #include<stdio.h>
    #include<math.h>
    #define PI 3.1415927
    using namespace std;
    int main()
    {
        int year,month,day;    
        char a,b,d;
        while(scanf("%d%c%d%c%d%c",&year,&a,&month,&b,&day,&d)!=EOF)
        {
            switch(month)
            {
            case 1:
                day=day;
                break;
            case 2:
                day=31+day;
                break;
            case 3:
                day=31+28+day;
                break;
            case 4:
                day=31+28+31+day;
                break;
            case 5:
                day=31+28+31+30+day;
                break;
            case 6:
                day=31+28+31+30+31+day;
                break;
            case 7:
                day=31+28+31+30+31+30+day;
                break;
            case 8:
                day=31+28+31+30+31+30+31+day;
                break;
            case 9:
                day=31+28+31+30+31+30+31+31+day;
                break;
            case 10:
                day=31+28+31+30+31+30+31+31+30+day;
                break;
            case 11:
                day=31+28+31+30+31+30+31+31+30+31+day;
                break;
            default:
                day=31+28+31+30+31+30+31+31+30+31+30+day;
            }
            if(month>2)
            {
            if(year%100==0)
            {
                if(year%400==0)
                {
                    day=day+1;
                    printf("%d
    ",day);
                }
                else
                {
                    printf("%d
    ",day);
                }
            }
            else
            {
                if(year%4==0)
                {
                    day=day+1;
                    printf("%d
    ",day);
                }
                else
                {
                    printf("%d
    ",day);
                }
            }
            }
            else
                printf("%d
    ",day);
        }
    }
  • 相关阅读:
    svn不提交.net项目中的bin
    java 与C# 时间格式 交互
    生成菜单序列号
    ashx 方法模板
    webservice使用方法
    如何配置IIS服务器?
    zepto.fullpage
    模拟单选框
    star score
    Hover show tips
  • 原文地址:https://www.cnblogs.com/Strugglinggirl/p/5988939.html
Copyright © 2011-2022 走看看