Kulesh

subsequence

Jan 5th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<math.h>
  3.  
  4. #define mod 1000000007
  5.  
  6. using namespace std;
  7.  
  8. long long f[100000];
  9.  
  10. long long factorial(long long x){
  11. if(x == 0){
  12. return f[x];
  13. }
  14. long long ans = ((x) * (factorial(x-1)) * 1LL) % mod;
  15. f[x] = ans;
  16. return ans;
  17. }
  18.  
  19. int main(){
  20. long long n ,m;
  21. cin >> n >> m;
  22. f[0] = 1;
  23. long long ans = ((factorial(n))/((f[m]) * (f[n-m]) * 1LL)) % mod;
  24. cout << ans;
  25. return 0;
  26. }
Add Comment
Please, Sign In to add comment