提交时间:2023-10-04 20:59:31
运行 ID: 104985
#include<stdlib.h> #include<stdio.h> 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; scanf("%d",&t); while(t) { c=0; scanf("%d %d",&m,&n); count(m,n,0); printf("%d\n",c); t--; } return 0; }