• <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 李現民 閱讀(282) 評論(0)  編輯 收藏 引用 所屬分類: USACO

            久久久久亚洲AV无码网站| 少妇人妻综合久久中文字幕| 日产精品99久久久久久| 久久亚洲精品国产亚洲老地址| 亚洲国产婷婷香蕉久久久久久 | 青青草原综合久久| 国产成人综合久久久久久| 国产精品丝袜久久久久久不卡| 国产精品久久婷婷六月丁香| 亚洲综合婷婷久久| 久久综合给合久久国产免费 | 久久人人爽人人爽人人片AV不| 大伊人青草狠狠久久| 99久久国产综合精品女同图片| 国产精品成人无码久久久久久 | 伊人久久无码中文字幕| 国产99久久久国产精品~~牛| 五月丁香综合激情六月久久| 久久青青草原精品国产不卡| 91久久精品电影| 国产亚洲美女精品久久久久狼| 中文字幕乱码久久午夜| 久久久久无码专区亚洲av| 丰满少妇人妻久久久久久4| 久久96国产精品久久久| 国内精品人妻无码久久久影院| 久久久国产打桩机| 综合久久一区二区三区| 久久久久女教师免费一区| 久久精品视频免费| 久久久青草久久久青草| 久久综合丝袜日本网| 久久综合久久综合久久| 伊人久久大香线蕉影院95| 青青青伊人色综合久久| yellow中文字幕久久网| 久久精品国产99久久香蕉| 免费一级欧美大片久久网 | 午夜精品久久久久久久| 久久国产亚洲精品无码| 久久久久一区二区三区|