結果

問題 No.170 スワップ文字列(Easy)
ユーザー GrenacheGrenache
提出日時 2016-02-14 17:58:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 4,903 ms
コンパイル使用メモリ 71,480 KB
実行使用メモリ 57,704 KB
最終ジャッジ日時 2023-08-24 16:27:15
合計ジャッジ時間 7,131 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,816 KB
testcase_01 AC 116 ms
56,412 KB
testcase_02 AC 115 ms
56,124 KB
testcase_03 AC 115 ms
55,656 KB
testcase_04 AC 116 ms
56,068 KB
testcase_05 AC 115 ms
55,980 KB
testcase_06 AC 115 ms
55,444 KB
testcase_07 AC 116 ms
56,060 KB
testcase_08 AC 115 ms
55,592 KB
testcase_09 AC 116 ms
55,972 KB
testcase_10 AC 117 ms
55,664 KB
testcase_11 AC 118 ms
55,964 KB
testcase_12 AC 117 ms
55,892 KB
testcase_13 AC 117 ms
56,184 KB
testcase_14 AC 120 ms
55,500 KB
testcase_15 AC 117 ms
55,684 KB
testcase_16 AC 115 ms
56,048 KB
testcase_17 AC 115 ms
55,468 KB
testcase_18 AC 115 ms
55,924 KB
testcase_19 AC 115 ms
55,684 KB
testcase_20 AC 115 ms
57,704 KB
testcase_21 AC 116 ms
55,672 KB
testcase_22 AC 115 ms
56,308 KB
testcase_23 AC 115 ms
56,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder170 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] s = sc.next().toCharArray();

        int[] a = new int[26];
        for (char c : s) {
        	a[c - 'A']++;
        }

        int[] fact = new int[8 + 1];
        fact[0] = 1;
        for (int i = 1; i <= 8; i++) {
        	fact[i] = fact[i - 1] * i;
        }

        int ret = fact[s.length];
        for (int e : a) {
        	ret /= fact[e];
        }

        System.out.println(ret - 1);

        sc.close();
    }
}
0