結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
![]() |
提出日時 | 2018-03-12 03:58:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 371 bytes |
コンパイル時間 | 1,337 ms |
コンパイル使用メモリ | 160,556 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 09:27:38 |
合計ジャッジ時間 | 2,141 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int fact(int n) { if (n == 0) { return 1; } else { return n * fact(n - 1); } } int main() { string s; cin >> s; int num[26] = { 0 }; for (int i = 0;i<s.size();i++) { num[s[i] - 'A']++; } int ans = fact(s.size()); for (int i = 0;i < 26;i++) { ans /= fact(num[i]); } cout << ans-1 << endl; return 0; }