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

            精品伊人久久久| 亚洲乱亚洲乱淫久久| 国产亚洲成人久久| 精品久久久久久久| 97久久综合精品久久久综合| 国产综合久久久久| 国产精品99久久久久久猫咪| 国产精品久久久久久久午夜片 | 日韩一区二区三区视频久久| 日韩精品久久久久久| 久久国产香蕉视频| 2021国产精品午夜久久 | 97久久国产露脸精品国产| AV无码久久久久不卡蜜桃| 999久久久免费精品国产| 99久久精品免费看国产免费| 亚洲欧洲久久av| 97精品久久天干天天天按摩| 欧美激情精品久久久久| 精品伊人久久久| 国产AⅤ精品一区二区三区久久| 亚州日韩精品专区久久久| 国产精品99久久精品| 亚洲中文字幕伊人久久无码| 国产精品无码久久久久久| 色天使久久综合网天天| 99久久精品无码一区二区毛片 | 国产亚洲欧美成人久久片| 久久久国产99久久国产一| 色综合久久久久| 日韩AV无码久久一区二区| 内射无码专区久久亚洲| 94久久国产乱子伦精品免费| 日韩av无码久久精品免费| 久久久国产99久久国产一| 激情综合色综合久久综合| 国产精品无码久久久久久| 久久久久久国产精品免费无码| 久久久久国产一级毛片高清板| 久久国产精品成人免费| 91久久精一区二区三区大全|