• <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久久婷婷国产综合精品草原| 久久久国产精品| 国内精品人妻无码久久久影院导航 | 麻豆AV一区二区三区久久| 国产美女久久久| 国产精品VIDEOSSEX久久发布| 久久99亚洲综合精品首页| 一本综合久久国产二区| 久久99精品国产麻豆| 国产69精品久久久久99| 久久久久久久精品妇女99| 99久久婷婷国产综合亚洲| 久久久人妻精品无码一区| 人妻无码久久一区二区三区免费| 久久香蕉一级毛片| 超级97碰碰碰碰久久久久最新| 99国产精品久久| 久久久午夜精品福利内容| 9191精品国产免费久久| 国产69精品久久久久久人妻精品| 国产ww久久久久久久久久| 午夜久久久久久禁播电影| 久久久久亚洲av成人无码电影 | 一级做a爰片久久毛片人呢| 日日狠狠久久偷偷色综合0| 蜜臀av性久久久久蜜臀aⅴ麻豆| 精品国产婷婷久久久| 99久久久精品免费观看国产| 久久久国产打桩机| 中文字幕无码久久人妻| 久久亚洲高清综合| 久久亚洲国产精品123区| 久久99精品久久久久久秒播| 日本免费一区二区久久人人澡 | 亚洲精品乱码久久久久66| 中文成人无码精品久久久不卡| 久久久久久无码国产精品中文字幕| 天天久久狠狠色综合| 国产精品热久久毛片| 久久久久久一区国产精品| 久久久久亚洲AV无码专区网站|