题解
2023-03-22 09:43:05
发布于:上海
64阅读
0回复
0点赞
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
const int inf = 5000005;
int n,m;
int ans=0;
void bfs(int a,int b,int c){
if(c==m){
if(b==n){
ans++;
}
return;
}
for(int i=a;b+i*(m-c)<=n;i++){
bfs(i,b+i,c+1);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin>>n>>m;
bfs(1,0,0);
cout<<ans<<endl;
return 0;
}
这里空空如也
有帮助,赞一个