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

            久久精品免费一区二区三区| 久久99久久无码毛片一区二区| 久久精品国产亚洲Aⅴ香蕉| 国产精品99久久久久久董美香| 久久久久国产| 久久久久99这里有精品10| 久久超碰97人人做人人爱| 国内精品久久久久久不卡影院| 色综合久久天天综线观看| 国产精品久久免费| 久久无码中文字幕东京热| 久久国产视屏| 久久亚洲欧美国产精品| 亚洲AV无码一区东京热久久| 久久青青色综合| 99久久精品久久久久久清纯| 精品国产一区二区三区久久| 久久国产热这里只有精品| 国产日产久久高清欧美一区| 亚洲国产精品成人久久蜜臀| 国产成人香蕉久久久久| 性高湖久久久久久久久| 怡红院日本一道日本久久| 中文国产成人精品久久不卡| 亚洲人成网站999久久久综合 | 日本福利片国产午夜久久| 91精品国产综合久久婷婷| 国内精品久久久久影院亚洲| 久久99精品国产麻豆蜜芽| 一级做a爱片久久毛片| 国产精品久久久久久久| 久久棈精品久久久久久噜噜| 伊人久久无码中文字幕| 久久AV高潮AV无码AV| 精品综合久久久久久888蜜芽| 久久久久无码精品国产| 欧美牲交A欧牲交aⅴ久久| 人妻久久久一区二区三区| 久久久一本精品99久久精品88| 一本色道久久99一综合| 无码人妻久久久一区二区三区|