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

            久久精品国产只有精品2020| 国产99精品久久| 久久人人爽人人澡人人高潮AV| 成人a毛片久久免费播放| 国内精品久久久久久麻豆| 免费一级做a爰片久久毛片潮| 99久久综合国产精品免费 | 2021久久精品国产99国产精品| 久久精品国产91久久麻豆自制| 久久久久久一区国产精品| 久久精品国产亚洲av麻豆图片| 精品国产福利久久久| 狠狠色丁香婷婷久久综合五月| 久久久91精品国产一区二区三区| 亚洲国产精品成人AV无码久久综合影院 | 嫩草影院久久国产精品| 精品国产99久久久久久麻豆| 99久久免费国产精品| 奇米影视7777久久精品| | 亚洲国产欧洲综合997久久| 精品久久一区二区| 无遮挡粉嫩小泬久久久久久久| 99久久国产综合精品五月天喷水 | 国产精品美女久久久久AV福利| 日韩人妻无码精品久久免费一 | 很黄很污的网站久久mimi色| 久久久久久久亚洲Av无码| 精品国产日韩久久亚洲| 女同久久| 久久久这里有精品| 思思久久精品在热线热| 欧美午夜A∨大片久久 | 精品久久人妻av中文字幕| 99精品久久久久久久婷婷| 亚洲欧美日韩久久精品| 欧美精品一区二区久久| 久久亚洲精品无码播放| 国内精品久久久久久久久| 久久丝袜精品中文字幕| 久久99热这里只频精品6|