• <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无码去区首| 香蕉久久永久视频| 性做久久久久久久| 一本久久a久久精品综合夜夜| 国产成人无码久久久精品一| 97久久精品人人澡人人爽| 亚洲精品国产综合久久一线| 国产成人精品免费久久久久| 伊人久久免费视频| 色欲av伊人久久大香线蕉影院| 狠狠色婷婷久久一区二区三区| 欧美日韩中文字幕久久久不卡| 亚洲第一极品精品无码久久| 久久激情五月丁香伊人| 青青草原精品99久久精品66| 久久久久国产精品嫩草影院| 亚洲精品乱码久久久久久按摩| 国产99久久久久久免费看| 国产69精品久久久久9999APGF | 欧美久久综合九色综合| 精品久久久久久国产潘金莲 | 亚洲?V乱码久久精品蜜桃 | 久久青草国产精品一区| 婷婷久久久亚洲欧洲日产国码AV| 中文字幕久久欲求不满| 少妇人妻综合久久中文字幕| 国产福利电影一区二区三区,免费久久久久久久精 | 国产毛片欧美毛片久久久| 久久国产精品国产自线拍免费| 久久亚洲私人国产精品| 亚洲国产精品高清久久久| 国内高清久久久久久| 狠狠色综合网站久久久久久久高清 | 一本色道久久88综合日韩精品| 欧美亚洲国产精品久久| 久久久久亚洲AV无码永不| 国产99久久久国产精免费|