• <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 閱讀(161) 評論(0)  編輯 收藏 引用 所屬分類: Questions
            哈哈哈哈哈哈
            2022年国产精品久久久久| 久久精品国产亚洲av麻豆蜜芽 | 久久狠狠一本精品综合网| 国产精品va久久久久久久| 亚洲AV无码久久精品狠狠爱浪潮| 久久综合久久自在自线精品自 | 久久亚洲综合色一区二区三区| 国产精品美女久久久久av爽| 亚洲精品无码专区久久久| 国产69精品久久久久777| 久久久久无码精品国产app| 久久综合88熟人妻| 久久久国产99久久国产一| 国内精品久久人妻互换| 久久久久久亚洲精品无码| 国产91久久精品一区二区| 久久99国产精品成人欧美| www.久久99| 色妞色综合久久夜夜| 热RE99久久精品国产66热| 日本福利片国产午夜久久| 精品久久久无码21p发布| 九九热久久免费视频| 国产精品久久久久9999| 久久综合综合久久综合| 亚洲国产成人精品女人久久久 | 亚洲欧洲精品成人久久奇米网| 美女写真久久影院| 久久se精品一区二区| 成人免费网站久久久| 人妻精品久久久久中文字幕69| 热99RE久久精品这里都是精品免费| 久久亚洲色一区二区三区| 久久综合亚洲色HEZYO国产| 久久精品成人免费国产片小草| 国产精品99久久久久久宅男| 99久久亚洲综合精品网站| 国产欧美一区二区久久| 99久久亚洲综合精品网站| 久久99毛片免费观看不卡| 国产精品一久久香蕉国产线看|