結果

問題 No.170 スワップ文字列(Easy)
ユーザー ぴろずぴろず
提出日時 2015-03-22 23:29:16
言語 Java19
(openjdk 21)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 616 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 71,996 KB
実行使用メモリ 56,212 KB
最終ジャッジ日時 2023-08-24 15:59:53
合計ジャッジ時間 6,788 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
55,768 KB
testcase_01 AC 145 ms
55,636 KB
testcase_02 AC 145 ms
55,968 KB
testcase_03 AC 146 ms
55,608 KB
testcase_04 AC 145 ms
55,692 KB
testcase_05 AC 145 ms
55,812 KB
testcase_06 AC 144 ms
56,204 KB
testcase_07 AC 144 ms
56,040 KB
testcase_08 AC 145 ms
55,984 KB
testcase_09 AC 143 ms
56,064 KB
testcase_10 AC 146 ms
56,212 KB
testcase_11 AC 144 ms
55,576 KB
testcase_12 AC 146 ms
55,928 KB
testcase_13 AC 149 ms
55,708 KB
testcase_14 AC 143 ms
55,488 KB
testcase_15 AC 144 ms
55,596 KB
testcase_16 AC 144 ms
56,196 KB
testcase_17 AC 146 ms
55,724 KB
testcase_18 AC 147 ms
55,700 KB
testcase_19 AC 146 ms
55,620 KB
testcase_20 AC 146 ms
55,740 KB
testcase_21 AC 147 ms
56,200 KB
testcase_22 AC 145 ms
55,732 KB
testcase_23 AC 146 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no170;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int[] count = new int[128];
		for(int i=0;i<s.length;i++) {
			count[s[i]]++;
		}
		BigInteger[] fact = new BigInteger[1001];
		fact[0] = BigInteger.ONE;
		for(int i=1;i<=1000;i++) {
			fact[i] = fact[i-1].multiply(BigInteger.valueOf(i));
		}
		BigInteger ans = fact[s.length];
		for(int i=0;i<128;i++) {
			ans = ans.divide(fact[count[i]]);
		}
		System.out.println(ans.subtract(BigInteger.ONE));
	}
}
0