結果

問題 No.171 スワップ文字列(Med)
ユーザー ぴろずぴろず
提出日時 2015-03-22 23:28:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 1,000 ms
コード長 651 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 72,284 KB
実行使用メモリ 58,300 KB
最終ジャッジ日時 2023-09-11 09:32:16
合計ジャッジ時間 4,723 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
55,724 KB
testcase_01 AC 146 ms
55,648 KB
testcase_02 AC 150 ms
56,320 KB
testcase_03 AC 145 ms
55,836 KB
testcase_04 AC 148 ms
56,296 KB
testcase_05 AC 152 ms
56,456 KB
testcase_06 AC 151 ms
56,272 KB
testcase_07 AC 148 ms
56,376 KB
testcase_08 AC 149 ms
56,256 KB
testcase_09 AC 145 ms
58,300 KB
testcase_10 AC 145 ms
56,188 KB
testcase_11 AC 148 ms
54,344 KB
testcase_12 AC 144 ms
55,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no171;

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).remainder(BigInteger.valueOf(573)));
	}
}
0