• <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>

            雪之精靈

            從吐絲結(jié)繭到破繭而出

            把自1970年1月1日以來的秒數(shù)轉(zhuǎn)化成年月日

            #include <iostream>
            using namespace std;

            bool IsRound(int year){
             if((year%100)&&(year%4==0)) return 1;
             if((year%100==0)&&(year%400==0)) return 1;
             return 0;
            }
            int main() {
             int n;
             int year_s[2]= {365*24*60*60, 366*24*60*60};
             int month_s[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},
               {31,29,31,30,31,30,31,31,30,31,30,31}};
             int day_s = 24*60*60;
             int hour_s = 60*60;
             int minute_s = 60;

             

             while(cin>>n){
                int temp = n;
                int year=1970;
                     int month=1;
                     int day=1;
                     int hour=0;
                     int minute=0;
                     int second=0;

                while(temp>=60){

                 int flag= IsRound(year);
                 if(temp>=year_s[flag]) { year++; temp-=year_s[flag]; }
                 else if(temp>=day_s){
                  int days = temp/day_s;
                  temp=temp%day_s;
                  int i=0;
                  int flag = IsRound(year);
                  int hh=31;
                  while(days>=hh){
                   days-=month_s[flag][i++];
                   hh=month_s[flag][i];
                   }
                  month+= i;
                  day+=days;

                 }else if(temp>=hour_s){
                      hour=temp/hour_s;
                      temp%=hour_s;
                 }else if(temp>=minute_s){
                       minute = temp/minute_s;
                       temp%=minute_s;
                 }
                 }
                 second = temp;

                    cout<<year<<"-";
                  if(month/10==0) cout<<"0";
                  cout<<month<<"-";
                  if(day/10==0) cout<<"0";
                  cout<<day<<" ";
                  if(hour/10==0) cout<<"0";
                  cout<<hour<<":";
                  if(minute/10==0) cout<<"0";
                  cout<<minute<<":";
                  if(second/10==0) cout<<"0";
                  cout<<second<<endl;
             }


             return 0;
            }

            posted on 2010-05-29 13:54 雪之精靈 閱讀(2202) 評論(0)  編輯 收藏 引用 所屬分類: c++算法


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            久久综合九色综合精品| 久久综合九色欧美综合狠狠| 久久精品无码专区免费青青| 国产精品久久国产精品99盘| 久久性生大片免费观看性| 一本色综合网久久| 国产成人精品久久亚洲高清不卡 | 久久人人爽人人爽人人片AV麻烦| 精品国产VA久久久久久久冰| 色诱久久av| 伊人色综合久久天天| 久久亚洲日韩精品一区二区三区| 久久精品中文字幕第23页| 久久久久亚洲AV无码麻豆| 香蕉久久夜色精品国产2020| 99久久综合狠狠综合久久止| 99精品久久久久久久婷婷| 亚洲?V乱码久久精品蜜桃 | 久久中文字幕一区二区| 伊人久久大香线蕉av不卡| 久久综合日本熟妇| 99久久99久久精品国产片果冻| 亚洲午夜久久久久久噜噜噜| 精品久久久久久无码不卡| 99久久99久久精品国产| 久久精品一区二区国产| 无码人妻少妇久久中文字幕蜜桃| 久久久噜噜噜久久| 久久久久亚洲AV成人网| 国产成人精品久久亚洲高清不卡 | 久久精品成人免费网站| 久久国产精品77777| 久久久久亚洲AV无码专区体验| 日本WV一本一道久久香蕉| 欧洲性大片xxxxx久久久| 久久亚洲高清综合| 欧美日韩精品久久久免费观看| 久久人人爽人人爽人人片AV麻烦 | 久久久久久噜噜精品免费直播 | 久久这里只精品国产99热| 久久久国产精品网站|