結果

問題 No.170 スワップ文字列(Easy)
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-21 02:32:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 628 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 71,592 KB
実行使用メモリ 56,668 KB
最終ジャッジ日時 2023-08-24 16:36:27
合計ジャッジ時間 5,921 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
55,720 KB
testcase_01 AC 114 ms
55,284 KB
testcase_02 AC 113 ms
56,132 KB
testcase_03 AC 113 ms
55,944 KB
testcase_04 AC 116 ms
55,960 KB
testcase_05 AC 113 ms
56,276 KB
testcase_06 AC 114 ms
55,616 KB
testcase_07 AC 113 ms
56,668 KB
testcase_08 AC 115 ms
55,876 KB
testcase_09 AC 113 ms
55,880 KB
testcase_10 AC 116 ms
55,768 KB
testcase_11 AC 113 ms
55,876 KB
testcase_12 AC 114 ms
56,104 KB
testcase_13 AC 113 ms
55,912 KB
testcase_14 AC 115 ms
56,172 KB
testcase_15 AC 114 ms
55,844 KB
testcase_16 AC 113 ms
56,004 KB
testcase_17 AC 114 ms
55,652 KB
testcase_18 AC 115 ms
55,404 KB
testcase_19 AC 115 ms
56,232 KB
testcase_20 AC 113 ms
55,468 KB
testcase_21 AC 114 ms
56,148 KB
testcase_22 AC 115 ms
56,048 KB
testcase_23 AC 112 ms
55,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int L = S.length();
        int [] al = new int [26];
        for(int i=0; i<L; i++){
            int t = S.charAt(i)-65;
            al[t]++;
        }
        int r=fac(L);
        for(int i=0; i<26; i++){
            int t= fac(al[i]);
            r/=t;
        }
        System.out.println(r-1);
    }
    static int fac(int x){
        if(x<=1){
            return 1;
        }else{
            int t = x*fac(x-1);
            return t;
        }
    }
}
0