結果

問題 No.170 スワップ文字列(Easy)
ユーザー fiord
提出日時 2015-05-14 23:38:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 67,628 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 00:28:16
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <map>
using namespace std;
typedef long long int ll;
typedef map<char,int> mmap;

int main(){
	mmap dic;
	string str;	cin>>str;
	int l=(int)str.size();
	for(int i=0;i<l;i++)	dic[str[i]]++;
	ll fact[l];
	fact[0]=1;
	for(int i=1;i<l;i++)	fact[i]=fact[i-1]*(i+1);
	int ans=fact[l-1];
	for(mmap::iterator i=dic.begin();i!=dic.end();i++)	ans/=fact[i->second-1];
	cout<<ans-1<<endl;
	return 0;
}
0