Advertisement
Korotkodul

комба_N5

Mar 2nd, 2023 (edited)
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <vector>
  11. #include <algorithm>
  12. #include <numeric>
  13. using namespace std;
  14. vector <int> F(13,0);
  15. int C(int n, int k) {
  16.     return F[n] / (F[k] * F[n - k]);
  17. }
  18. int main()
  19. {
  20.     F[0] = 1;
  21.     for (int i = 1; i < 13; ++i) {
  22.         F[i] = F[i - 1] * i;
  23.     }
  24.     vector <int> v = {C(9,0) * C(9, 4), 3 * C(9, 1) * C(8, 4), 3 * C(9, 2) * C(7, 4), C(9, 3) * C(6, 4)};
  25.     int ans = 0;
  26.     for (int i: v) ans += i;
  27.     cout << ans << "\n";
  28.     cout << C(8, 3) * C(9, 4);
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement