【POJ1664】放苹果

problem

solution

codes

#include<iostream>
using namespace std;
const int maxn = 11;
int f[maxn][maxn];
int main(){
    for(int i = 0; i < maxn; i++)f[0][i]=f[i][1]=1;
    for(int i = 1; i < maxn; i++)
        for(int j = 2; j < maxn; j++)
            f[i][j] = j>i?f[i][i]:f[i][j-1]+f[i-j][j];
    int t; cin>>t;
    while(t--){
        int n, m;
        cin>>n>>m;
        cout<<f[n][m]<<"
";
    }
    return 0;
}
原文地址:https://www.cnblogs.com/gwj1314/p/9444805.html