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

            久久国产精品99精品国产| 99久久婷婷国产综合精品草原| 久久久WWW成人免费毛片| 亚洲午夜福利精品久久| 欧美黑人又粗又大久久久 | 大美女久久久久久j久久| 久久久久久国产a免费观看不卡| 久久久久亚洲爆乳少妇无 | 精品久久久一二三区| 久久久久亚洲精品天堂| 精品欧美一区二区三区久久久| 中文字幕精品无码久久久久久3D日动漫 | 久久精品国产一区| 欧美日韩精品久久久久| 波多野结衣中文字幕久久| 日本高清无卡码一区二区久久 | 亚洲精品tv久久久久久久久 | 久久婷婷五月综合成人D啪| 久久久精品免费国产四虎| 亚洲人成网站999久久久综合| 99国产精品久久| 偷偷做久久久久网站| 狠狠色伊人久久精品综合网| 久久精品99久久香蕉国产色戒 | 亚洲?V乱码久久精品蜜桃 | 久久se精品一区二区影院| 99久久99这里只有免费费精品| 久久人妻少妇嫩草AV蜜桃| 久久精品免费网站网| 91久久九九无码成人网站| 久久99久久99精品免视看动漫| 久久这里有精品| 久久只有这里有精品4| 久久久这里只有精品加勒比| 久久亚洲高清综合| 久久人人爽人爽人人爽av| 久久精品不卡| 亚洲欧美日韩久久精品| 久久一本综合| 国内精品伊人久久久影院| 伊人久久大香线蕉av不卡|