結果
| 問題 | No.170 スワップ文字列(Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-24 14:06:24 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 329µs | |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 952 ms |
| コンパイル使用メモリ | 188,400 KB |
| 実行使用メモリ | 9,896 KB |
| 最終ジャッジ日時 | 2026-10-07 10:24:04 |
| 合計ジャッジ時間 | 2,920 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int fac(int x)
{
if(x == 1) return 1;
return x * fac(x - 1);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
string s; cin >> s;
map<char, int> mp;
for(int i = 0; i < s.size(); i++) mp[s[i]]++;
int ans = fac(s.size());
for(auto i = mp.begin(); i != mp.end(); i++) {
ans /= fac(i->second);
}
cout << ans - 1 << endl;
return 0;
}