fork download
  1. #include <bits/stdc++.h>
  2. #define endl "\n"
  3. using namespace std;
  4. int main()
  5. {
  6. ios_base::sync_with_stdio(0);
  7. cin.tie(0);
  8. long long a[201][201], mod = 1e9 + 7;
  9. for (int i = 0; i <= 200; i++)
  10. {
  11. for (int j = 0; j <= i; j++)
  12. {
  13. if (j == 0 || j == i)
  14. a[i][j] = 1;
  15. else
  16. a[i][j] = (a[i - 1][j] % mod + a[i - 1][j - 1] % mod) % mod;
  17. }
  18. }
  19. int t;
  20. cin >> t;
  21. while (t--)
  22. {
  23. int b, c;
  24. cin >> c >> b;
  25. cout << a[c + b][c] << endl;
  26. }
  27. }
  28. /* Do Xuan Huong
  29. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  30. @@@@@@@@@@@@@@@@@@@@@@##################@@@@@@@@@@@@@@@@@@@@@
  31. @@@@@@@@@@@@@@@@#############################@@@@@@@@@@@@@@@@
  32. @@@@@@@@@@@@&####################################@@@@@@@@@@@@
  33. @@@@@@@@@@##########################################@@@@@@@@@
  34. @@@@@@@@##############################################@@@@@@@
  35. @@@@@@#################################################@@@@@@
  36. @@@@@####################################################@@@@
  37. @@@%#####################@@@@@@@@@@@######################@@@
  38. @@@###################@@@@@@@@@@@@@@@@@####################@@
  39. @@##################@@@@@@ @@@@@@##################@@
  40. @@#################@@@@@ @@@@###################@
  41. @@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@
  42. @ &@@@@ @@@@ .......@@
  43. @@ @@@@@@ @@@@@@ .......@@
  44. @@ @@@@@@@@@@@@@@@@@ .......@@@
  45. @@@ @@@@@@@@@@@ ......@@@@
  46. @@@@ ......@@@@@
  47. @@@@@@ ......@@@@@@
  48. @@@@@@@ .....@@@@@@@@
  49. @@@@@@@@@ .....@@@@@@@@@@
  50. @@@@@@@@@@@@ ....@@@@@@@@@@@@@
  51. @@@@@@@@@@@@@@@@ ....@@@@@@@@@@@@@@@@
  52. @@@@@@@@@@@@@@@@@@@@@% .@@@@@@@@@@@@@@@@@@@@@@
  53. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  54. */
Success #stdin #stdout 0s 5304KB
stdin
2

2 2

100 100
stdout
6
407336795