• <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 閱讀(156) 評論(0)  編輯 收藏 引用 所屬分類: Questions
            哈哈哈哈哈哈
            国内精品久久久久伊人av| 精品多毛少妇人妻AV免费久久 | 人妻少妇久久中文字幕一区二区| 狠狠色丁香久久婷婷综合_中| 久久丫精品国产亚洲av不卡 | 狠狠久久综合| 久久久久国产精品嫩草影院| 97久久超碰成人精品网站| 欧美粉嫩小泬久久久久久久| 久久人人爽人人爽人人AV东京热| 免费一级做a爰片久久毛片潮| 久久人人爽人人爽人人AV | 国产精品美女久久久免费| 亚洲人成网站999久久久综合 | 久久综合综合久久综合| 久久av高潮av无码av喷吹| 久久精品国产亚洲av麻豆小说| 一日本道伊人久久综合影| 91精品国产91热久久久久福利| 亚洲AV日韩AV永久无码久久| 婷婷久久综合九色综合绿巨人| 久久婷婷国产麻豆91天堂| 久久精品中文闷骚内射| 囯产精品久久久久久久久蜜桃| 久久九九免费高清视频| 中文字幕成人精品久久不卡| 国内精品伊人久久久久AV影院| 97精品依人久久久大香线蕉97| 亚洲综合久久夜AV | 欧美久久久久久| 久久精品国产亚洲αv忘忧草| 中文成人久久久久影院免费观看 | 久久综合久久综合亚洲| 色悠久久久久久久综合网| 精品久久久久一区二区三区 | 久久婷婷五月综合成人D啪| 国产精品美女久久久网AV| 狠狠色综合久久久久尤物| 久久久久久噜噜精品免费直播| 久久久国产精品| 午夜精品久久久内射近拍高清|