結果

問題 No.170 スワップ文字列(Easy)
ユーザー くれちー
提出日時 2016-12-26 14:23:27
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 310 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 00:45:44
合計ジャッジ時間 963 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int f(int n) {
	if (n <= 1) return 1;
	else return n * f(n - 1);
}

int main() {
	int s, c['z' + 1] = {}, cnt = 0;
	while ((s = getchar()) != '\n') { c[s]++; cnt++; }
	
	int t = 1, i;
	for (i = 'A'; i <= 'Z'; i++) t *= f(c[i]);
	int ans = f(cnt) / t - 1;

	printf("%d\n", ans);
	return 0;
}
0