結果
問題 | No.170 スワップ文字列(Easy) |
ユーザー |
![]() |
提出日時 | 2018-02-15 01:54:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 543 ms |
コンパイル使用メモリ | 81,008 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 14:21:42 |
合計ジャッジ時間 | 1,376 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { string S; cin >> S; int a[26] = {0}; int n = S.length(); for ( int i = 0; i < n; i++ ) { a[S[i]-'A']++; } long long ans = 1; while ( n ) { ans *= n; n--; } long long d = 1; for ( int i = 0; i < 26; i++ ) { int x = a[i]; long long y = 1; while ( x ) { y *= x; x--; } d *= y; } ans /= d; ans--; cout << ans << endl; return 0; }