• <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 閱讀(160) 評論(0)  編輯 收藏 引用 所屬分類: Questions
            哈哈哈哈哈哈
            偷偷做久久久久网站| 国内精品久久久久久久亚洲| 欧美午夜A∨大片久久| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 久久综合色老色| 亚洲精品美女久久777777| 久久狠狠爱亚洲综合影院| 国产精品青草久久久久婷婷| 久久国产综合精品五月天| 中文字幕久久精品无码| 99久久无码一区人妻| 无遮挡粉嫩小泬久久久久久久| 99久久亚洲综合精品成人| 久久天天躁夜夜躁狠狠| 日韩一区二区久久久久久| 99久久国产亚洲综合精品| 国内精品免费久久影院| AV色综合久久天堂AV色综合在| 久久久久综合国产欧美一区二区| 国内精品久久久久影院一蜜桃| 欧美精品九九99久久在观看| 国产免费福利体检区久久| 国产精品久久永久免费| 午夜天堂精品久久久久| 香蕉aa三级久久毛片| 久久久久一本毛久久久| 国产精品VIDEOSSEX久久发布| 久久精品人人做人人爽97| 久久午夜无码鲁丝片秋霞| 亚洲人成无码网站久久99热国产| 久久99国产一区二区三区| 久久99精品国产麻豆蜜芽| 久久国产成人午夜aⅴ影院 | 久久亚洲精品成人无码网站| 久久久免费观成人影院| 国产精品伊人久久伊人电影 | 国产精品亚洲综合久久| 一本久久a久久精品综合香蕉| 中文字幕精品久久久久人妻| 久久久久亚洲AV片无码下载蜜桃| 国内精品久久久久影院老司|