結果

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

ソースコード

diff #

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

int fact(int n)
{
	int result = 1;
	for (int i = 2; i <= n; i++) {
		result *= i;
	}
	return result;
}

int main(int argc, char **argv)
{
	string S;
	cin >> S;
	
	vector<int> V(26);
	for (char ch : S) V[ch - 'A']++;

	int result = fact(S.length());
	for (int n : V) result /= fact(n);
	result--;
	cout << result << endl;
}
0