結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-20 13:59:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 522 bytes |
| コンパイル時間 | 1,530 ms |
| コンパイル使用メモリ | 171,104 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-27 06:55:08 |
| 合計ジャッジ時間 | 2,405 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
signed main(){
string S; cin >> S;
vector< int > cnt( 256 );
for( int i = 0; i < S.size(); ++i )
++cnt[ S[ i ] ];
vector< int > fcnt;
for( int i = 0; i < 256; ++i )
if( cnt[ i ] > 1 )
fcnt.emplace_back( cnt[ i ] );
function< int ( int ) > fact = [ & ]( int x ){ return x == 0 ? 1 : x * fact( x - 1 ); };
int ans = fact( ( int ) S.size() );
for( int i = 0; i < fcnt.size(); ++i )
ans /= fact( fcnt[ i ] );
cout << ans << endl;
return 0;
}