放苹果

GitHub跳转原题关系图返回列表

题意与原解析均从本地 OpenJudge 缓存迁移。

OJ: noi_openjudge

题目 ID: ch0202-666

难度:未知

标签:

日期: 2026-07-30 23:01

题意

完整题面见同目录的 problem.md

思路

代码

cpp
#include <bits/stdc++.h>
using namespace std;
#define F(n) for(int i =1;i<=n;i++)
#define F3(i,s,t) for(int i =s;i<=t;i++)
int tot; // total
int m,n;

int cnt; // count

// pre ,
// dep = depth 
void apple(int pre,int left,int dep)
{
    if( dep == n) {
        if( left >= pre )
            cnt++;
        return ;
    }
    F3(i,pre,left) {
        apple(i,left-i,dep+1);
    }
}


int main(){
    cin >> tot;
    F(tot) {
        cin >> m >> n;
        cnt = 0;
        apple(0,m,1);
        cout << cnt << endl;
    }
    return 0;
}

复杂度

总结