Advertisement
Saleh127

UVA 10338

May 5th, 2021
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll f[25];
  11. ll i,j,k,l;
  12.  
  13. f[0]=1;
  14. for(i=1;i<=20;i++)
  15. {
  16. f[i]=f[i-1]*i;
  17. }
  18.  
  19. string a;
  20.  
  21. test
  22. {
  23. cin>>a;
  24. l=1;
  25. map<char,ll>x;
  26.  
  27. for(i=0;i<a.size();i++)
  28. {
  29. x[a[i]]++;
  30. }
  31. l=f[a.size()];
  32.  
  33. for(char s='A' ;s<='Z';s++)
  34. {
  35. if(x[s]) l/=f[x[s]];
  36. }
  37.  
  38. cout<<"Data set "<<cs<<": "<<l<<endl;
  39. }
  40.  
  41. return 0;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement