結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
![]() |
提出日時 | 2018-05-04 13:34:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 638 ms |
コンパイル使用メモリ | 71,488 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 01:01:42 |
合計ジャッジ時間 | 1,471 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <map> using namespace std; #define INF 2000000007 #define MOD 1000003 #define MAX 105 #define REP(i,n) for(int i=0;i<(n);++i) #define REPS(i,s,t) for(int i=(s);i<(t);++i) typedef unsigned int uint; typedef unsigned long long int ull; int main(){ string str; cin >> str; vector<int> p(10,1); REPS(i,2,str.size()+1){ p[i] = p[i-1]*i; } map<char,int> st; for(char t:str){ if(st[t]) st[t]++; else st[t] = 1; } int ans = p[str.size()]; for(auto t:st){ if(t.second > 1) ans /= p[t.second]; } ans--; cout << ans << endl; return 0; }