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

            国产成人精品综合久久久| 久久久久久毛片免费看| 亚洲精品午夜国产VA久久成人 | 国产精品伦理久久久久久| 老司机午夜网站国内精品久久久久久久久 | 亚洲欧美日韩精品久久亚洲区| 噜噜噜色噜噜噜久久| 久久久久久精品免费免费自慰| 国产精品久久久久无码av| 色妞色综合久久夜夜| 久久久久综合国产欧美一区二区 | 中文无码久久精品| 久久综合九色欧美综合狠狠| 久久午夜福利无码1000合集| 久久精品国产精品青草| 久久久久久久97| av色综合久久天堂av色综合在| 91秦先生久久久久久久| 国产精品久久99| 777午夜精品久久av蜜臀| 日批日出水久久亚洲精品tv| 青青久久精品国产免费看| MM131亚洲国产美女久久| 国产精品久久精品| 亚洲伊人久久大香线蕉综合图片| 久久久久亚洲AV成人网| 成人国内精品久久久久影院VR| 久久66热人妻偷产精品9| 亚洲中文字幕久久精品无码喷水| 无码八A片人妻少妇久久| 伊人色综合久久天天网| 欧美与黑人午夜性猛交久久久| 亚洲午夜久久影院| 国产精品视频久久久| 国产精品一久久香蕉国产线看| 久久国产高潮流白浆免费观看| 日韩人妻无码一区二区三区久久| 国内精品久久久久久99| 久久久久成人精品无码中文字幕 | 久久免费视频1| 777午夜精品久久av蜜臀|