fork download
  1. #include<iostream>
  2. using namespace std;
  3. int tohop(int n, int k)
  4. {
  5. if(k == 0 || k == n)
  6. return 1;
  7. return tohop(n-1, k-1) + tohop(n-1, k);
  8. }
  9. int main()
  10. {
  11. ios_base::sync_with_stdio(false);
  12. cin.tie(0);cout.tie(0);
  13. int t;
  14. cin >> t;
  15. while(t--)
  16. {
  17. int n, k;
  18. cin >> n >> k;
  19. if(k > n)
  20. cout << -1;
  21. else
  22. cout << tohop(n,k);
  23. cout << "\n";
  24. }
  25. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
Standard output is empty