結果

問題 No.171 スワップ文字列(Med)
ユーザー Lay_ecLay_ec
提出日時 2015-03-23 00:13:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 1,000 ms
コード長 691 bytes
コンパイル時間 3,262 ms
コンパイル使用メモリ 74,820 KB
実行使用メモリ 58,672 KB
最終ジャッジ日時 2023-09-11 09:40:08
合計ジャッジ時間 5,859 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,720 KB
testcase_01 AC 117 ms
55,444 KB
testcase_02 AC 154 ms
56,292 KB
testcase_03 AC 118 ms
56,196 KB
testcase_04 AC 120 ms
56,424 KB
testcase_05 AC 130 ms
55,932 KB
testcase_06 AC 156 ms
58,332 KB
testcase_07 AC 156 ms
58,368 KB
testcase_08 AC 154 ms
58,672 KB
testcase_09 AC 145 ms
57,836 KB
testcase_10 AC 116 ms
55,872 KB
testcase_11 AC 118 ms
55,536 KB
testcase_12 AC 117 ms
56,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

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

		String s = sc.next();

		int num[]=new int[26];
		for(int i=0;i<26;i++) num[i]=0;
		for(int i=0;i<s.length();i++){
			num[s.charAt(i)-'A']++;
		}

		BigInteger div = BigInteger.ONE;
		for(int i=0;i<26;i++){
			for(int j=num[i];j>0;j--) div=div.multiply(new BigInteger(String.valueOf(j)));
		}

		BigInteger res = BigInteger.ONE;
		for(int j=s.length();j>0;j--) res=res.multiply(new BigInteger(String.valueOf(j)));
		res=res.divide(div);
		res=res.subtract(BigInteger.ONE);
		res=res.mod(new BigInteger("573"));

		System.out.println(res);
	}
}
0