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

            清風(fēng)竹林

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

            Friday the Thirteenth


            題目:Friday the Thirteenth

            簡(jiǎn)答:


            /*
            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 李現(xiàn)民 閱讀(276) 評(píng)論(0)  編輯 收藏 引用 所屬分類: USACO

            天天躁日日躁狠狠久久| 久久久久久国产精品免费无码| 亚洲国产视频久久| 亚洲国产成人乱码精品女人久久久不卡 | 久久精品国产99国产精品亚洲| 国内精品免费久久影院| 国产叼嘿久久精品久久| 精品国产热久久久福利| 久久国产成人午夜aⅴ影院 | 久久久久久狠狠丁香| 97久久久精品综合88久久| 国内精品久久久久久99| 亚洲国产精品婷婷久久| 精品国产综合区久久久久久 | 久久久久国产精品麻豆AR影院| 久久久久亚洲爆乳少妇无| 久久精品国产一区二区三区不卡| 久久93精品国产91久久综合| 亚洲第一永久AV网站久久精品男人的天堂AV | 久久国语露脸国产精品电影| 久久综合久久自在自线精品自| 国内精品久久久久久久97牛牛| 99精品久久久久久久婷婷| 香蕉久久AⅤ一区二区三区| 亚洲综合熟女久久久30p| 久久er热视频在这里精品| 久久久这里有精品中文字幕| 亚洲精品午夜国产VA久久成人| 99精品久久精品一区二区| 日韩va亚洲va欧美va久久| 亚洲国产精品久久久天堂| 99精品伊人久久久大香线蕉| 怡红院日本一道日本久久 | 久久精品免费一区二区| 久久人人爽爽爽人久久久| 久久久黄片| 国内精品久久久久| 久久人人爽人人爽人人片AV不| 久久99精品国产99久久6男男| 亚洲性久久久影院| 成人精品一区二区久久|