fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <set>
  4. #include <map>
  5. using namespace std;
  6. long long int binomialCoeff(long long int n,long long int k)
  7. {
  8.  
  9. if (k==0 || k==n)
  10. return 1;
  11.  
  12.  
  13. return binomialCoeff(n-1, k-1) + binomialCoeff(n-1, k);
  14. }
  15. long long int multiplyNumbers(long long int n)
  16. {
  17. if (n >= 1)
  18. return n*multiplyNumbers(n-1);
  19. else
  20. return 1;
  21. }
  22. int main() {
  23. // your code goes here
  24. long long t;
  25. scanf("%lld",&t);
  26. while(t--)
  27. {
  28. string s;
  29. cin>>s;
  30. long long countc=0,countv=0;
  31. for(int i=0;i<s.length();i++)
  32. {
  33. if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')
  34. {
  35. countv++;
  36. }
  37. else
  38. countc++;
  39. }
  40. long long p,q;
  41. scanf("%lld %lld",&p,&q);
  42. long long a=binomialCoeff(countc,p);
  43. long long b=binomialCoeff(countv,q);
  44. long long c=multiplyNumbers(p+q);
  45. long long ans=(a*b)*c;
  46. printf("%lld\n",ans);
  47. }
  48. return 0;
  49. }
  50.  
Success #stdin #stdout 0s 3472KB
stdin
2
codecell
2 2
crackathon
4 3
stdout
720
176400