• <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热这里只有精品66| 亚洲人成电影网站久久| 2021精品国产综合久久| 久久久久噜噜噜亚洲熟女综合| 久久精品国产亚洲AV影院| 日产精品久久久一区二区| 51久久夜色精品国产| 国产激情久久久久久熟女老人| 国产精品美女久久久久网| 亚洲欧洲久久久精品| 97久久精品无码一区二区| 亚洲国产日韩欧美综合久久| 国产精品一久久香蕉国产线看观看| 久久久久亚洲精品中文字幕| 国产精品一久久香蕉国产线看观看| 久久九九久精品国产免费直播| 99久久精品毛片免费播放| 日日狠狠久久偷偷色综合96蜜桃| 久久综合国产乱子伦精品免费| 要久久爱在线免费观看| 国产精品成人久久久久久久| 久久ZYZ资源站无码中文动漫| 亚洲va久久久久| 亚洲国产成人久久综合碰| 精品久久久久久久久久久久久久久| 无遮挡粉嫩小泬久久久久久久| 国产精品久久久久久久app| 精品99久久aaa一级毛片| 久久精品国产亚洲网站| 无码精品久久久天天影视 | 久久www免费人成看国产片| 久久精品无码一区二区WWW| 亚洲中文字幕伊人久久无码| 久久精品国产一区二区三区不卡| 成人国内精品久久久久影院VR | 精品久久久久久国产牛牛app| 青青国产成人久久91网| 色综合久久中文综合网| 91久久精品国产91性色也|