結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
|
提出日時 | 2018-03-20 16:57:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 56,656 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 01:00:57 |
合計ジャッジ時間 | 1,249 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<iostream> #include<string> #define REP(i,n) for(int i=0;i<n;i++) #define FACTORIAL(j,n) int ans=1;for(int j=0;j<n;j++){ans*=(n-j);} using namespace std; int main() { string s; int denom, numer = 1, count[26] = {}; cin >> s; FACTORIAL(j, s.length()) denom = ans; REP(i, s.length()) count[s[i] - 'A']++; REP(i, 26) { if (count[i]) { FACTORIAL(j, count[i]) numer *= ans; } } cout << denom / numer - 1; }