• <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
            
                  就是這個(gè)題目上次我寫整數(shù)劃分的時(shí)候半天也沒找到。。。直接用遞歸會(huì)超時(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 閱讀(163) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Questions
            哈哈哈哈哈哈
            久久精品国产亚洲AV无码麻豆| 久久婷婷五月综合成人D啪| 久久婷婷五月综合97色| 99久久精品毛片免费播放| 激情综合色综合久久综合| 18禁黄久久久AAA片| 91精品国产综合久久香蕉 | 人人狠狠综合久久亚洲高清| 色婷婷久久综合中文久久蜜桃av| 国产AⅤ精品一区二区三区久久| 国产aⅴ激情无码久久| 久久av高潮av无码av喷吹| 精品久久久噜噜噜久久久| 18禁黄久久久AAA片| 久久国产精品波多野结衣AV| www.久久99| 久久精品人人做人人爽97| 亚洲性久久久影院| 久久久无码精品亚洲日韩软件| 久久精品国产亚洲一区二区| 看久久久久久a级毛片| 久久午夜福利无码1000合集| 久久伊人色| 亚洲国产成人精品91久久久| 久久九九久精品国产| A级毛片无码久久精品免费| 久久国产精品国产自线拍免费 | 国内精品欧美久久精品| 精品国产91久久久久久久| 久久国产亚洲高清观看| 久久ZYZ资源站无码中文动漫| 亚洲色欲久久久综合网| 久久精品一区二区三区AV| 免费精品久久天干天干| 麻豆av久久av盛宴av| 欧美亚洲国产精品久久久久| 思思久久好好热精品国产| 2020国产成人久久精品| 亚洲人成伊人成综合网久久久 | 99热热久久这里只有精品68| 欧美激情精品久久久久久久|