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

            久久精品国产精品亚洲艾草网美妙| 热99RE久久精品这里都是精品免费 | 最新久久免费视频| 人妻少妇精品久久| 久久精品久久久久观看99水蜜桃 | 久久久久亚洲AV成人网人人网站| 精品久久久久一区二区三区| 99久久99久久精品国产片| 日日狠狠久久偷偷色综合96蜜桃| 久久免费国产精品| 欧美精品国产综合久久| 久久久久99精品成人片欧美| 久久91这里精品国产2020| 久久综合九色综合久99| 久久久久久综合网天天| 久久国产精品一国产精品金尊| 久久精品视频网| 久久人人青草97香蕉| 久久线看观看精品香蕉国产| 久久亚洲AV无码精品色午夜麻豆| 亚洲AV无码久久精品成人| 久久久精品日本一区二区三区| 伊人伊成久久人综合网777| 久久99久久99小草精品免视看| 国产高潮国产高潮久久久91 | 欧美精品一区二区精品久久| 亚洲国产成人精品无码久久久久久综合 | 精品久久久久久国产| 免费观看成人久久网免费观看| 一级做a爰片久久毛片毛片| 91精品国产综合久久精品| 人妻久久久一区二区三区| 伊人热热久久原色播放www| 99久久99这里只有免费费精品| 精品久久久久久中文字幕大豆网| 国产999精品久久久久久| 久久精品中文闷骚内射| 久久精品国产亚洲AV影院 | 狠狠色噜噜色狠狠狠综合久久| 伊人久久一区二区三区无码| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 |