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

            日本高清无卡码一区二区久久| 久久发布国产伦子伦精品| 青青草国产精品久久久久| 久久av免费天堂小草播放| 久久午夜免费视频| 久久99毛片免费观看不卡 | 久久精品国产亚洲AV忘忧草18| 婷婷久久精品国产| 蜜臀av性久久久久蜜臀aⅴ | 亚洲人成伊人成综合网久久久| 久久66热人妻偷产精品9| 久久久久97国产精华液好用吗| 久久久国产精品亚洲一区| 精品久久久久久国产免费了| 久久午夜伦鲁片免费无码| 久久性精品| 久久ww精品w免费人成| 伊人久久无码精品中文字幕| 97超级碰碰碰久久久久| 2021国产精品久久精品| 久久无码精品一区二区三区| 四虎国产精品免费久久久| 久久亚洲私人国产精品| 久久综合色老色| 青青热久久国产久精品 | 99久久国产精品免费一区二区| 狠狠色丁香婷婷综合久久来来去 | 国内精品久久久久久久亚洲| 久久精品国产亚洲av麻豆小说| 欧美激情一区二区久久久| 久久久久久亚洲精品无码| 夜夜亚洲天天久久| 青青青青久久精品国产| 久久国产精品99精品国产| 日韩精品无码久久久久久| 狠狠色丁香久久婷婷综合蜜芽五月| 国内精品久久久久久久影视麻豆| 91亚洲国产成人久久精品网址| 久久免费精品一区二区| 色综合久久综精品| 激情综合色综合久久综合|