

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <iostream> using namespace std; int resident(int a, int b) { if (b == 1) return 1; if (a == 0) return b; return (resident(a – 1, b) + resident(a, b – 1)); } int main() { int T, k, n; cin >> T; for (int i = 0; i < T; i++) { cin >> k >> n; cout << resident(k, n) << endl; } } | cs |