結果

問題 No.171 スワップ文字列(Med)
ユーザー ki_ki33ki_ki33
提出日時 2015-03-22 23:39:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 1,000 ms
コード長 1,368 bytes
コンパイル時間 3,425 ms
コンパイル使用メモリ 88,664 KB
実行使用メモリ 58,396 KB
最終ジャッジ日時 2023-09-11 09:35:28
合計ジャッジ時間 4,997 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
53,840 KB
testcase_01 AC 120 ms
55,896 KB
testcase_02 AC 152 ms
56,656 KB
testcase_03 AC 123 ms
56,500 KB
testcase_04 AC 123 ms
55,828 KB
testcase_05 AC 134 ms
55,628 KB
testcase_06 AC 154 ms
56,380 KB
testcase_07 AC 154 ms
58,004 KB
testcase_08 AC 157 ms
58,276 KB
testcase_09 AC 157 ms
58,396 KB
testcase_10 AC 119 ms
53,848 KB
testcase_11 AC 120 ms
53,712 KB
testcase_12 AC 121 ms
55,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListSet;

public class Main {
	public static final int C =  1000000007;
	static final int CY = 1000000000;
	//static boolean MAP[][];
	static int K;
	static int B;
	static int[][] POS;
	static String S;
	static int X[][];
	static int HA[];
	static long DP[];
	static int ST[][];
	static ConcurrentSkipListSet<Integer> TS;
	static ArrayList<Integer> AL;
	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);

		S = sc.next();
		
	

		BigInteger ans = new BigInteger("1");
		
		int[] a = new int[26];
		
		for (int i=0; i < S.length(); i++) {
			char c = S.charAt(i);
			a[c - 'A']++;
		}

		ans = msd(S.length());
		for (int i=0; i< 26; i++) {
			ans = ans.divide(msd(a[i]));
		}


		System.out.println(ans.add(new BigInteger("-1")).mod(new BigInteger("573")));
	}
	static BigInteger msd(int num) {
		BigInteger ret = new BigInteger("1");
		
		for (int i=1; i <= num; i++) {
			ret = ret.multiply(new BigInteger("" + i));
		}
		
		return ret;
	}
}
0