結果

問題 No.170 スワップ文字列(Easy)
ユーザー wing3196wing3196
提出日時 2015-03-22 23:28:38
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 590 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 79,580 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 00:08:24
合計ジャッジ時間 1,410 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int fac(int n){
	int ans = n;
	while(--n>1) ans *= n;
	return ans;
}

int main(){
	string S;
	int cnt[26] = {};
	cin>>S;
	for(int i=0;i<S.size();i++){
		cnt[S[i]-'A']++;
	}
	int ans = fac(S.size());
	for(int i=0;i<26;i++){
		if(cnt[i]>1){
			ans /= fac(cnt[i]);
		}
	}
	printf("%d\n",ans-1);
	return 0;
}
0