• <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++算法

            九九热久久免费视频| 久久无码中文字幕东京热| 99国内精品久久久久久久| 91精品国产综合久久香蕉| 久久久久亚洲AV无码观看| 国内精品伊人久久久久| 久久精品卫校国产小美女| 伊人久久免费视频| 亚洲精品无码久久久久sm| 精品无码人妻久久久久久| 国产精品久久波多野结衣| 欧美亚洲国产精品久久久久| 婷婷久久综合九色综合98| 久久综合给合久久狠狠狠97色| 欧美粉嫩小泬久久久久久久 | 99久久夜色精品国产网站| 久久―日本道色综合久久| 狠狠色婷婷久久综合频道日韩| 精品国产婷婷久久久| 午夜精品久久久久久久| 久久久久国产精品嫩草影院| 蜜桃麻豆www久久国产精品| 亚洲成色999久久网站| 国产亚洲欧美成人久久片| 久久夜色精品国产亚洲| 亚洲精品成人久久久| 青青热久久国产久精品| 久久精品?ⅴ无码中文字幕| 狠狠人妻久久久久久综合蜜桃| 久久免费小视频| 久久中文字幕人妻熟av女| 久久人妻少妇嫩草AV蜜桃| 久久WWW免费人成—看片| 久久久亚洲精品蜜桃臀| 久久er国产精品免费观看8| 久久久久亚洲AV无码去区首| 久久免费大片| 色婷婷综合久久久久中文| 国产亚洲色婷婷久久99精品| 久久成人精品视频| 青青草原1769久久免费播放|