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

            免费精品99久久国产综合精品| 久久久久久狠狠丁香| 中文字幕乱码久久午夜| 少妇久久久久久久久久| 99久久夜色精品国产网站| 久久精品二区| 99久久久国产精品免费无卡顿| 中文字幕成人精品久久不卡| 亚洲欧洲精品成人久久奇米网| 久久久久人妻一区精品色| 人妻丰满?V无码久久不卡| 浪潮AV色综合久久天堂| 亚洲国产天堂久久久久久| 狠色狠色狠狠色综合久久| 一本一本久久A久久综合精品| 超级碰久久免费公开视频| 中文无码久久精品| 久久久受www免费人成| 久久91精品国产91久久麻豆| 国产偷久久久精品专区 | 国内精品人妻无码久久久影院导航| 久久综合九色综合网站| 国产精品久久久久久久app| 久久精品亚洲乱码伦伦中文 | 久久久www免费人成精品| 久久99精品免费一区二区| 久久精品一区二区国产| 久久精品天天中文字幕人妻| 欧美日韩精品久久久免费观看 | 日日噜噜夜夜狠狠久久丁香五月| 热RE99久久精品国产66热| 久久综合成人网| 久久久久久国产a免费观看不卡| 日韩精品久久久久久| 精品国产一区二区三区久久久狼| 久久久久久曰本AV免费免费| 久久精品免费一区二区| 伊人久久精品无码二区麻豆| 久久久无码一区二区三区| 国产精品美女久久久m| 精品国产91久久久久久久|