結果

問題 No.170 スワップ文字列(Easy)
コンテスト
ユーザー くれちー
提出日時 2016-12-26 14:23:27
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 310 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 218 ms
コンパイル使用メモリ 38,488 KB
最終ジャッジ日時 2026-02-24 00:00:33
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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