• <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中文字幕无码久久| 亚洲精品综合久久| 欧美久久久久久午夜精品| 精品久久久中文字幕人妻| 亚洲精品WWW久久久久久 | 久久人与动人物a级毛片| 精品久久人妻av中文字幕| 综合久久国产九一剧情麻豆| 久久久国产99久久国产一| 久久中文字幕精品| 97久久精品无码一区二区| 久久青青草原精品国产| 国产精品久久久久影视不卡| 国产毛片久久久久久国产毛片| 18岁日韩内射颜射午夜久久成人 | 久久人人爽人人人人爽AV| 久久综合欧美成人| 99久久综合狠狠综合久久止| 丁香色欲久久久久久综合网| 中文字幕精品无码久久久久久3D日动漫| 久久一日本道色综合久久| 国产亚洲色婷婷久久99精品| 国产精品99久久久精品无码| 久久精品国产精品亜洲毛片| 天天影视色香欲综合久久| 国产福利电影一区二区三区,免费久久久久久久精 | 久久久久人妻精品一区 | 久久无码av三级| 97精品国产91久久久久久| 久久国产色AV免费观看| 久久久精品人妻一区二区三区四| 2021最新久久久视精品爱| 亚洲AV无码一区东京热久久| A级毛片无码久久精品免费| 亚洲综合伊人久久大杳蕉| 国产精品女同久久久久电影院| 国内精品伊人久久久久av一坑|