提交时间:2023-12-18 13:50:31
运行 ID: 116718
#include<iostream> using namespace std; int c; void count(int m,int n,int start) { int i,j; if(n==1) c++; else if(m<n) count(m,m,0); else{ for(i=start;i<=m/n;i++) count(m-i,n-1,i); } } int main() { int t,m,n; cin>>t; while(t){ c=0; cin>>m>>n; count(m,n,0); cout<<c; t--; } return 0; }