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

            雪之精靈

            從吐絲結繭到破繭而出

            把自1970年1月1日以來的秒數轉化成年月日

            #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 雪之精靈 閱讀(2211) 評論(0)  編輯 收藏 引用 所屬分類: c++算法

            伊人久久综合无码成人网| 国产精品成人久久久久三级午夜电影| 亚洲欧美成人久久综合中文网| 久久久久se色偷偷亚洲精品av| 亚洲人成网亚洲欧洲无码久久| 精品国际久久久久999波多野| 久久久久国产一区二区| 久久香综合精品久久伊人| 国产精品伦理久久久久久| 久久久久久精品久久久久| 99久久99久久精品国产片| 亚洲精品无码久久久久sm| 久久91精品综合国产首页| 99久久久精品免费观看国产| 中文字幕无码久久精品青草| 国产呻吟久久久久久久92| 久久久久亚洲Av无码专| 久久久精品国产免大香伊| 久久久久国产精品嫩草影院| 久久99国产精品久久| 人妻久久久一区二区三区| 久久精品国产日本波多野结衣| 久久激情五月丁香伊人| 中文字幕成人精品久久不卡| 久久91综合国产91久久精品| 亚洲va久久久噜噜噜久久男同 | 久久人妻少妇嫩草AV蜜桃| 久久播电影网| 国产精品日韩深夜福利久久| 久久综合九色综合久99| 精品久久久久久| 狠狠色丁香久久婷婷综| 亚洲国产精品久久| 91久久成人免费| 国产午夜精品理论片久久| 亚洲国产精品人久久| 国产精品99久久久久久www| 久久久久99精品成人片| 伊人久久大香线蕉综合热线| 伊人久久大香线蕉AV一区二区| 一本色道久久88—综合亚洲精品|