• <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>

            清風竹林

            ぷ雪飄絳梅映殘紅
               ぷ花舞霜飛映蒼松
                 ----- Do more,suffer less

            Friday the Thirteenth


            題目:Friday the Thirteenth

            簡答:


            /*
            ID: lixianm1
            PROG: friday
            LANG: C++
            */
            #include 
            <fstream>
            #include 
            <iostream>
            #include 
            <vector>
            #include 
            <map>
            #include 
            <string>
            #include 
            <cassert>

            inline 
            bool IsLeapYear(unsigned int nYear) {return ((!(nYear&3))&&(0!=nYear%100))||(0==nYear%400);}

            int main(int argc, char* argv[]) 
            {    
                
            //////////////////////////////////////////////////////////////////////////open the file
                std::string strInFile    = "friday.in";
                std::
            string strOutFile    = "friday.out";

                std::ifstream fin(strInFile.c_str());
                std::ofstream fout(strOutFile.c_str());

                
            if (!fin)
                {
                    std::cout
            <<"failed to open file for read"<<std::endl;
                    
            return 1;
                }
                
            if (!fout)
                {
                    std::cout
            <<"failed to open file for write"<<std::endl;
                    fin.close();
                    
            return 1;
                }
                
            //////////////////////////////////////////////////////////////////////////read file and init all variables
                

                
            int N;
                fin
            >>N;

                
            //////////////////////////////////////////////////////////////////////////process

                
            static int month_day[]={0312831303130313130313031};
                
            static int month_day2[]={0312931303130313130313031};

                
            int aWeekCount[7]={0};
                unsigned 
            int nTotalDays= 0;

                
            for (int i=0; i<N; ++i)
                {
                    
            for (int nMonth=1; nMonth<13++nMonth)
                    {
                        
            ++aWeekCount[(nTotalDays+12)%7];
                        
                        
            if (!IsLeapYear(1900+i))
                        {
                            nTotalDays
            +=month_day[nMonth];
                        }
            else
                        {
                            nTotalDays
            +=month_day2[nMonth];
                        }            
                    }        
                }
                
                
            //////////////////////////////////////////////////////////////////////////write the process result
                for (int i=0; i<6++i)
                {
                    fout
            <<aWeekCount[(i+5)%7]<<" ";
                }
                fout
            <<aWeekCount[4]<<std::endl;

                
            //////////////////////////////////////////////////////////////////////////end and exit
                fin.close();
                fout.close();

                
            //system("pause");
                return 0;
            }

            posted on 2008-12-03 14:00 李現民 閱讀(276) 評論(0)  編輯 收藏 引用 所屬分類: USACO

            无码人妻久久一区二区三区蜜桃| 亚洲伊人久久成综合人影院| 久久久久久国产精品美女| 久久青青草原精品国产不卡| 亚洲国产欧洲综合997久久| 欧美精品九九99久久在观看| 久久久精品人妻一区二区三区四| 69久久夜色精品国产69| 国产精品成人99久久久久91gav| 色综合久久久久综合99| 久久久久青草线蕉综合超碰| 2022年国产精品久久久久| 国产呻吟久久久久久久92| 久久精品国产99国产精品导航 | 性做久久久久久久久老女人| 中文字幕无码免费久久| 亚洲日本久久久午夜精品| 国产精品一区二区久久精品| 日本欧美久久久久免费播放网| 99精品国产免费久久久久久下载| 欧美久久一级内射wwwwww.| 久久精品午夜一区二区福利 | 开心久久婷婷综合中文字幕| 精品国产乱码久久久久久1区2区 | 久久久不卡国产精品一区二区 | 久久久精品国产免大香伊| 久久久91精品国产一区二区三区| 日韩乱码人妻无码中文字幕久久| 久久播电影网| 亚洲国产成人精品无码久久久久久综合| 久久精品中文字幕一区| 久久免费视频一区| 久久久久亚洲精品无码网址| 91久久成人免费| 国产精品久久久久免费a∨| 久久免费视频一区| 日韩中文久久| 久久亚洲精品国产亚洲老地址 | 国产Av激情久久无码天堂| 无码国内精品久久综合88| 一本一本久久a久久精品综合麻豆|