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

            久久91精品国产91| 94久久国产乱子伦精品免费| 久久综合伊人77777| 亚洲人成无码www久久久| 青青草原综合久久大伊人| 精品国产乱码久久久久久郑州公司| 99久久精品国内| 亚洲精品美女久久久久99小说| 国产成人精品综合久久久| 久久99精品国产99久久| 国内精品人妻无码久久久影院导航 | 久久青青草原精品国产| 久久综合久久综合九色| 久久乐国产综合亚洲精品| 久久久青草久久久青草| 亚洲AV成人无码久久精品老人| 精品久久人人妻人人做精品| 久久婷婷五月综合国产尤物app| 久久天天躁狠狠躁夜夜2020老熟妇 | 无码国产69精品久久久久网站| 久久狠狠一本精品综合网| 久久综合九色综合网站| 中文字幕无码久久人妻| 欧美久久一区二区三区| 狠狠色丁香久久婷婷综| 色婷婷综合久久久久中文| 99精品久久精品一区二区| 色婷婷综合久久久久中文字幕| 青青草原综合久久| 久久精品国产免费| 久久久国产乱子伦精品作者| 性做久久久久久久| 久久天堂AV综合合色蜜桃网| 一本久久综合亚洲鲁鲁五月天| 色偷偷88欧美精品久久久 | 国内精品久久久久影院亚洲| 少妇久久久久久被弄到高潮| 久久久久99精品成人片三人毛片 | 热99RE久久精品这里都是精品免费 | 久久久久亚洲AV无码专区桃色| 国产精品欧美久久久久无广告|