• <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 李現民 閱讀(276) 評論(0)  編輯 收藏 引用 所屬分類: USACO

            av色综合久久天堂av色综合在| 国产成人香蕉久久久久| 2019久久久高清456| 少妇内射兰兰久久| 嫩草影院久久国产精品| 久久精品18| www久久久天天com| 中文字幕精品久久久久人妻| 久久精品中文字幕无码绿巨人| 国产综合精品久久亚洲| 亚洲国产欧洲综合997久久| 国产免费久久精品99久久| 三上悠亚久久精品| 一级女性全黄久久生活片免费 | 国产香蕉97碰碰久久人人| 一本色综合久久| 91精品国产91久久久久久| 亚洲精品蜜桃久久久久久| 亚洲欧美国产精品专区久久| 久久亚洲欧美日本精品| 国产精品女同久久久久电影院| 老司机午夜网站国内精品久久久久久久久 | 久久久久久国产精品美女| 久久97久久97精品免视看| 成人国内精品久久久久影院| 久久人人爽人人爽人人片av麻烦 | 久久丫精品国产亚洲av不卡| 色婷婷久久综合中文久久一本| 久久青青草原国产精品免费 | 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 色婷婷久久久SWAG精品| 青青草国产精品久久| 狠狠色婷婷久久一区二区三区| 97久久婷婷五月综合色d啪蜜芽| 亚洲午夜无码久久久久小说 | 久久99国产综合精品女同| 97精品国产97久久久久久免费| 久久九九久精品国产免费直播| 久久婷婷五月综合国产尤物app| 久久中文字幕人妻丝袜| 中文字幕无码免费久久|