提交时间:2023-10-05 11:23:27
运行 ID: 105183
#include <iostream> using namespace std; int cnt; void count(int m , int n , int s) { if(n == 1) cnt++; else if(m < n) count(m , m , 0); else { for(int i = s;i <= m / n;i++) count(m - i , n - 1 , i); } } int main() { int n; cin >> n; int x , y; while(n) { cnt = 0; cin >> x >> y; count(x , y , 0); cout << cnt << endl; n--; } return 0; }