Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

大家可以进一步做整数划分的题 HOJ1402 综合性比较好,有兴趣可以看看

Posted by xubenben at 2011-07-28 20:01:07 on Problem 1664
这是我的AC代码

#include <iostream>
#include <cstdlib>

using namespace std;

int main(int argc, char** argv) {

    int f[22][22];
    memset(f, 0, sizeof (f));
    f[0][0] = 1;

    for (int i = 1; i < 21; ++i)for (int j = 1; j <= i; ++j) {
            f[i][j] = f[i - 1][j - 1] + f[i - j][j];
        }

    int cas;
    cin >> cas;

    while (cas--) {
        int sum = 0;

        int m, n;
        cin >> m >> n;
        for (int i = 1; i <= n; i++) {
            sum += f[m][i];
        }
        printf("%d\n", sum);
    }


    return 0;
}


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator