結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-02-20 00:05:48 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 538 bytes |
| コンパイル時間 | 3,234 ms |
| コンパイル使用メモリ | 277,820 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-20 00:05:52 |
| 合計ジャッジ時間 | 4,224 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
string s;
cin >> s;
vector<int> cnt(26, 0);
for (char c : s) cnt[c - 'A']++;
vector<ll> fact(14, 1);
for (int i = 1; i < 14; i++) fact[i] = fact[i - 1] * i;
ll ans = fact[s.size()];
for (int i = 0; i < 26; i++) ans /= fact[cnt[i]];
cout << ans - 1 << endl;
return 0;
}
a01sa01to