• <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 閱讀(160) 評論(0)  編輯 收藏 引用 所屬分類: Questions
            哈哈哈哈哈哈
            久久精品人成免费| 无码国内精品久久综合88| 国产亚洲美女精品久久久久狼| 亚洲AV无码久久寂寞少妇| 久久久综合九色合综国产| 国产精品一区二区久久精品无码| 亚洲美日韩Av中文字幕无码久久久妻妇 | 久久精品国产亚洲沈樵| 99久久婷婷国产综合精品草原 | 久久久久久久综合日本亚洲 | 色婷婷综合久久久中文字幕| 久久久综合九色合综国产| 久久99这里只有精品国产| 亚洲国产精品热久久| 久久国产免费直播| 久久久久人妻一区精品| 99久久精品费精品国产一区二区| 中文字幕无码久久久| 狠狠色丁香婷婷综合久久来来去| 久久精品九九亚洲精品| 狠狠综合久久AV一区二区三区| 国产免费久久精品99久久| 精品久久久久久久久中文字幕| 亚洲国产欧美国产综合久久| 亚洲精品无码专区久久同性男| 岛国搬运www久久| 91久久香蕉国产熟女线看| 久久精品国产精品青草| 久久se精品一区精品二区| 久久国产精品一区二区| 国产精品久久精品| 久久精品国产亚洲综合色| 国产精品美女久久久| 久久本道伊人久久| 精品久久久久久国产| 伊人丁香狠狠色综合久久| 久久精品国产福利国产秒| 久久99精品国产麻豆宅宅| 久久国产精品国产自线拍免费| 久久精品男人影院| 久久精品国产精品亚洲人人|