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

            久久久久久久波多野结衣高潮| 91精品国产91久久综合| 欧洲性大片xxxxx久久久| 思思久久99热只有频精品66 | 精品久久久久香蕉网| 亚洲国产成人久久精品动漫| 久久久久国色AV免费看图片| 无码人妻久久一区二区三区| 99久久99久久精品国产| 久久久亚洲裙底偷窥综合| 国产精品久久久久久久| 三级韩国一区久久二区综合| 久久久久亚洲av无码专区| 蜜臀久久99精品久久久久久| 久久国产色AV免费观看| 伊人久久大香线蕉综合热线| 久久免费美女视频| 久久免费的精品国产V∧| 久久久精品人妻无码专区不卡| 国产午夜免费高清久久影院| 伊人久久大香线蕉无码麻豆| 99久久亚洲综合精品成人| 麻豆亚洲AV永久无码精品久久| 天天综合久久一二三区| 日本免费久久久久久久网站| 久久国产精品99精品国产| 亚洲级αV无码毛片久久精品 | 精品水蜜桃久久久久久久| 蜜臀久久99精品久久久久久小说| 亚洲午夜福利精品久久| 久久久无码精品亚洲日韩软件| 精品国产热久久久福利| 日本久久久久久中文字幕| www.久久精品| 一本大道久久a久久精品综合 | 久久影院综合精品| 久久久久女人精品毛片| AAA级久久久精品无码片| 国产成人久久精品激情| 国产精品99久久精品| 99久久99久久精品国产片果冻|