• <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>
            voip
            風(fēng)的方向
            厚德致遠(yuǎn),博學(xué)敦行!
            posts - 52,comments - 21,trackbacks - 0

            Ignatius and the Princess III

            Time Limit:1000MS  Memory Limit:65536K
            Total Submit:86 Accepted:66

            Description

            "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says.

            "The second problem is, given an positive integer N, we define an equation like this:
            N=a[1]+a[2]+a[3]+...+a[m];
            a[i]>0,1<=m<=N;
            My question is how many different equations you can find for a given N.
            For example, assume N is 4, we can find:
            4 = 4;
            4 = 3 + 1;
            4 = 2 + 2;
            4 = 2 + 1 + 1;
            4 = 1 + 1 + 1 + 1;
            so the result is 5 when N is 4. Note that "4 = 3 + 1" and "4 = 1 + 3" is the same in this problem. Now, you do it!"

            Input

            The input contains several test cases. Each test case contains a positive integer N(1<=N<=120) which is mentioned above. The input is terminated by the end of file.

            Output

            For each test case, you have to output a line contains an integer P which indicate the different equations you have found.

            Sample Input

            4
            10
            20
            

             

            Sample Output

            5
            42
            627
            
                  就是這個題目上次我寫整數(shù)劃分的時候半天也沒找到。。。直接用遞歸會超時!!
            代買如下:
            #include<cstdio>
            int main()
            {
                
            int i,j,n,c[121][121];
                
            for(i=1;i<121;i++)
                    
            for(j=1;j<121;j++)
                    
            {
                        
            if(i==1||j==1)
                            c[i][j]
            =1;
                        
            else if(i<j)
                            c[i][j]
            =c[i][i];
                        
            else if(i==j)
                            c[i][j]
            =c[i][j-1]+1;
                        
            else
                            c[i][j]
            =c[i][j-1]+c[i-j][j];
                    }

                
            while(scanf("%d",&n)!=EOF)
                
            {
                    printf(
            "%d\n",c[n][n]);
                }

                
            return 0;
            }


            
            
            posted on 2010-09-19 13:59 jince 閱讀(161) 評論(0)  編輯 收藏 引用 所屬分類: Questions
            哈哈哈哈哈哈
            久久精品夜夜夜夜夜久久| 久久丫精品国产亚洲av| 欧美伊人久久大香线蕉综合69| 国产精品九九久久免费视频| 亚洲国产成人精品91久久久| avtt天堂网久久精品| 久久91精品综合国产首页| 午夜精品久久久久久中宇| 国产高潮国产高潮久久久91 | 国产精品亚洲美女久久久| 久久免费看黄a级毛片| 色综合合久久天天综合绕视看| 久久国产精品无| 久久久久这里只有精品| 狠狠色婷婷综合天天久久丁香| 久久午夜无码鲁丝片午夜精品| 久久亚洲AV成人出白浆无码国产| 久久无码精品一区二区三区| 久久青草国产精品一区| 人妻无码αv中文字幕久久 | 亚洲综合久久综合激情久久| 久久久久亚洲AV成人网人人网站 | 99久久精品国产一区二区三区| 中文字幕久久波多野结衣av| 亚洲色欲久久久久综合网| 国产69精品久久久久99| 国产V亚洲V天堂无码久久久| 亚洲AV无码1区2区久久| 国产成人精品综合久久久| 婷婷国产天堂久久综合五月| 色悠久久久久久久综合网 | 狠狠色丁香久久婷婷综合蜜芽五月| 亚洲国产精品热久久| 精品综合久久久久久97超人| 97久久久久人妻精品专区| 久久久噜噜噜久久中文福利| 亚洲欧美国产精品专区久久| 思思久久99热免费精品6| 久久天天躁狠狠躁夜夜2020 | 国内精品久久久人妻中文字幕| 人妻无码久久一区二区三区免费|