• <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
            風的方向
            厚德致遠,博學敦行!
            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
            
                  就是這個題目上次我寫整數劃分的時候半天也沒找到。。。直接用遞歸會超時!!
            代買如下:
            #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
            哈哈哈哈哈哈
            国产精品中文久久久久久久| 中文字幕日本人妻久久久免费 | 色狠狠久久综合网| 人妻无码αv中文字幕久久琪琪布| 久久精品一区二区三区AV| 久久久久久久久久久久中文字幕| 一级做a爱片久久毛片| 亚洲精品无码专区久久同性男| 777午夜精品久久av蜜臀| 88久久精品无码一区二区毛片 | 久久久精品久久久久特色影视| 精品久久人人爽天天玩人人妻| 久久久青草青青亚洲国产免观| 免费精品国产日韩热久久| 亚洲国产精品久久久久婷婷软件 | 久久综合综合久久综合| 99久久国产综合精品五月天喷水| 久久久久久免费视频| 久久精品无码一区二区app| 久久亚洲精品无码AV红樱桃| 久久精品国产99国产精品| 97久久精品人妻人人搡人人玩| 久久婷婷五月综合国产尤物app | 久久噜噜久久久精品66| 九九99精品久久久久久| 久久99精品久久久久久hb无码| 久久WWW免费人成一看片| 亚洲另类欧美综合久久图片区| 91精品久久久久久无码| 日韩精品久久久久久| 97久久精品人妻人人搡人人玩| 久久亚洲精品成人av无码网站| 国内精品伊人久久久久777| 亚洲人成无码久久电影网站| 久久se精品一区二区影院| 99久久亚洲综合精品网站| 国产成人99久久亚洲综合精品| 99久久中文字幕| 国产成人久久精品麻豆一区| 久久精品夜色噜噜亚洲A∨| 久久黄视频|