結果

問題 No.170 スワップ文字列(Easy)
ユーザー smiken_61
提出日時 2015-10-11 19:07:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 464 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 65,316 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 00:32:13
合計ジャッジ時間 1,302 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
using namespace std;



int main() {
	string s;
	int nu[30] = {0};
	int kai[] = { 1,1,2,6,24,120,720,5040,40320 };

	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		nu[s[i] - 'A']++;
	
	}
	int l = s.length();
	int ans = 1;
	for (int i = 0; i < 26; i++) {
	
		ans = ans*kai[l] / kai[nu[i]] / kai[l - nu[i]];
		l = l - nu[i];
	
	}

	cout << ans - 1 << endl;
	return 0;
}
0