結果

問題 No.171 スワップ文字列(Med)
ユーザー kzyKTkzyKT
提出日時 2015-03-23 00:04:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 163 ms / 1,000 ms
コード長 833 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 74,468 KB
実行使用メモリ 59,028 KB
最終ジャッジ日時 2023-09-11 09:39:27
合計ジャッジ時間 4,685 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,760 KB
testcase_01 AC 121 ms
55,676 KB
testcase_02 AC 151 ms
56,252 KB
testcase_03 AC 122 ms
56,256 KB
testcase_04 AC 123 ms
56,084 KB
testcase_05 AC 137 ms
56,044 KB
testcase_06 AC 163 ms
55,928 KB
testcase_07 AC 152 ms
57,892 KB
testcase_08 AC 155 ms
58,172 KB
testcase_09 AC 156 ms
59,028 KB
testcase_10 AC 117 ms
56,032 KB
testcase_11 AC 118 ms
56,008 KB
testcase_12 AC 120 ms
55,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.lang.*;
import java.util.*;
import java.math.*;

public class Main {
    static Scanner cin = new Scanner(System.in);
    public static void main(String[] args) {
	String s=cin.next();
	BigInteger a=BigInteger.ONE;
	for(int i=1; i<=s.length(); i++) {
	    BigInteger b = new BigInteger(String.valueOf(i));
	    a=a.multiply(b);
	}
	int[] c = new int[26];
	for(int i=0; i<s.length(); i++) {
	    char ch=s.charAt(i);
	    int t=Character.getNumericValue(ch);
	    c[t-10]++;
	}
	for(int i=0; i<26; i++) {
	    BigInteger d=BigInteger.ONE;
	    for(int j=0; j<c[i]; j++) {
		BigInteger b = new BigInteger(String.valueOf(j+1));
		d=d.multiply(b);
	    }
	    a=a.divide(d);
	}
	a=a.subtract(BigInteger.ONE);
	BigInteger mod = new BigInteger(String.valueOf(573));
	System.out.println(a.mod(mod));


    }
}
0