• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            coreBugZJ

            此 blog 已棄。

            The Date, FZU 2011年3月月賽之 E, FZU 2014

            Problem 2014 The Date

            Time Limit: 1000 mSec    Memory Limit : 32768 KB

            Problem Description

            abcdxyzk believes that 2012.12.21 is the doomsday after he watched the movie “2012”. He counts how many days later the doomsday will come! However he doesn’t keep the date in mind!

            You are given one integer N, indicating N days later, the doomsday will come, and abcdxyzk wants to know the date now!

            Input

            There are several test cases.

            For each case, only one integer N in a single line , indicating N days later, the doomsday will come. (1<=n<= 1000000)

            Output

            For each test case, output the date now in format “yyyy-mm-dd”, where “yyyy” is the year, “mm” is the month and “dd” is the day.

            Sample Input

            1085
            1

            Sample Output

            2010-01-01
            2012-12-20

            Source

            FOJ有獎月賽-2011年03月



            簡單模擬


             1 #include <stdio.h>
             2 
             3 #define  L  1000009
             4 
             5 int year[ L ], month[ L ], day[ L ];
             6 
             7 int isint y ) {
             8         return (y%400==0|| ((y%100!=0)&&(y%4==0));
             9 }
            10 
            11 void init() {
            12         int totD[] = { 0312831303130313130313031 };
            13         int i;
            14         year[ 0 ] = 2012;
            15         month[ 0 ] = 12;
            16         day[ 0 ] = 21;
            17         for ( i = 1; i < L; ++i ) {
            18                 year[ i ] = year[ i - 1 ];
            19                 month[ i ] = month[ i - 1 ];
            20                 day[ i ] = day[ i - 1 ];
            21                 if ( --day[ i ] == 0  ) {
            22                         if ( --month[ i ] == 0 ) {
            23                                 --year[ i ];
            24                                 month[ i ] = 12;
            25                         }
            26                         day[ i ] = totD[ month[ i ] ];
            27                         if ( (is(year[i])) && (month[i]==2) ) {
            28                                 ++day[ i ];
            29                         }
            30                 }
            31         }
            32 }
            33 
            34 int main() {
            35         int n;
            36         init();
            37         while ( scanf("%d"&n) == 1 ) {
            38                 printf( "%4d-%02d-%02d\n", year[n], month[n], day[n] );
            39         }
            40         return 0;
            41 }
            42 


            posted on 2011-03-20 20:07 coreBugZJ 閱讀(1377) 評論(0)  編輯 收藏 引用 所屬分類: ACM

            精品无码人妻久久久久久| 国产亚洲色婷婷久久99精品91| 久久久久综合中文字幕| 久久久中文字幕日本| 久久精品aⅴ无码中文字字幕不卡| 久久精品水蜜桃av综合天堂| 亚洲国产精品人久久| 久久久久久久91精品免费观看| 人妻无码αv中文字幕久久琪琪布| 99热成人精品热久久669| 久久久久黑人强伦姧人妻| 人妻久久久一区二区三区| 国产AV影片久久久久久| 久久亚洲精品成人AV| 久久精品无码av| 国产精品久久久久久久久鸭| 久久精品日日躁夜夜躁欧美| 久久综合狠狠综合久久激情 | 亚洲愉拍99热成人精品热久久| 久久精品国产99久久丝袜| 国内精品久久久久| 亚洲综合伊人久久综合| 久久影视国产亚洲| 国产国产成人久久精品| 99久久精品国产高清一区二区| 囯产极品美女高潮无套久久久| 久久久久久久久久免免费精品| 婷婷综合久久中文字幕| 久久久噜噜噜久久熟女AA片| 婷婷久久香蕉五月综合加勒比| 久久青青色综合| 久久久噜噜噜久久中文字幕色伊伊| 丁香五月综合久久激情| 91精品国产综合久久四虎久久无码一级| 久久精品天天中文字幕人妻| 亚洲αv久久久噜噜噜噜噜| 精品一二三区久久aaa片| 久久人做人爽一区二区三区| 久久精品人妻中文系列| 97精品依人久久久大香线蕉97| 亚洲AV日韩AV天堂久久|