結果
| 問題 | No.170 スワップ文字列(Easy) | 
| コンテスト | |
| ユーザー |  penta2himajin | 
| 提出日時 | 2018-11-16 22:07:00 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 825 bytes | 
| コンパイル時間 | 986 ms | 
| コンパイル使用メモリ | 83,728 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 14:16:12 | 
| 合計ジャッジ時間 | 2,136 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------
int main(){
  int fact[9]={1,1,2,6,24,120,720,5040,40320},num[26]={},ans=0;
  string s;
  cin >> s;
  ans = fact[s.length()];
  for(int i=0;i<s.length();i++) num[s[i]-'A']++;
  ans=fact[s.length()];
  for(int i=0;i<26;i++) ans/=fact[num[i]];
  cout << ans-1 << endl;
}
            
            
            
        