結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
![]() |
提出日時 | 2018-11-09 21:07:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 1,545 ms |
コンパイル使用メモリ | 175,204 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 05:22:59 |
合計ジャッジ時間 | 2,622 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { string S; cin >> S; map<char,int> m; int sumN=1; for (int i = 0; i < S.length(); i++) { m[S[i]]++; sumN *= i+1; } int sum = 1; for (auto itr = m.begin(); itr != m.end(); itr++) { int n = itr->second; for (int i = n; i > 0; i--) { sum *= i; } } cout << sumN/sum-1 << endl; }