結果

問題 No.170 スワップ文字列(Easy)
ユーザー kenkooookenkoooo
提出日時 2015-03-24 20:03:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 564 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 71,024 KB
実行使用メモリ 56,496 KB
最終ジャッジ日時 2023-08-24 16:09:41
合計ジャッジ時間 5,809 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,664 KB
testcase_01 AC 115 ms
55,996 KB
testcase_02 AC 115 ms
55,372 KB
testcase_03 AC 115 ms
55,748 KB
testcase_04 AC 115 ms
55,756 KB
testcase_05 AC 117 ms
56,352 KB
testcase_06 AC 116 ms
55,824 KB
testcase_07 AC 114 ms
55,896 KB
testcase_08 AC 114 ms
56,260 KB
testcase_09 AC 114 ms
55,828 KB
testcase_10 AC 115 ms
55,828 KB
testcase_11 AC 116 ms
55,812 KB
testcase_12 AC 113 ms
55,792 KB
testcase_13 AC 115 ms
55,892 KB
testcase_14 AC 114 ms
55,732 KB
testcase_15 AC 115 ms
56,128 KB
testcase_16 AC 115 ms
56,200 KB
testcase_17 AC 114 ms
55,672 KB
testcase_18 AC 115 ms
55,764 KB
testcase_19 AC 116 ms
55,576 KB
testcase_20 AC 116 ms
56,496 KB
testcase_21 AC 115 ms
55,540 KB
testcase_22 AC 116 ms
56,028 KB
testcase_23 AC 116 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(System.in);
		char[] input = scanner.next().toCharArray();
		scanner.close();

		int[] alphabets = new int[26];
		for (int i = 0; i < input.length; i++) {
			alphabets[(int) input[i] - 'A']++;
		}
		long ans = 1;
		for (int i = 1; i <= input.length; i++) {
			ans *= i;
		}
		for (int i = 0; i < alphabets.length; i++) {
			for (int j = 1; j <= alphabets[i]; j++) {
				ans /= j;
			}
		}
		System.out.println(ans - 1);

	}
}
0