結果

問題 No.170 スワップ文字列(Easy)
ユーザー scachescache
提出日時 2015-05-26 19:46:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 3,761 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 60,648 KB
最終ジャッジ日時 2023-09-20 13:39:05
合計ジャッジ時間 8,486 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
59,944 KB
testcase_01 WA -
testcase_02 AC 134 ms
60,028 KB
testcase_03 AC 135 ms
59,924 KB
testcase_04 AC 135 ms
60,192 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 135 ms
60,088 KB
testcase_08 AC 134 ms
60,100 KB
testcase_09 AC 136 ms
60,208 KB
testcase_10 WA -
testcase_11 AC 134 ms
60,120 KB
testcase_12 AC 134 ms
60,172 KB
testcase_13 AC 133 ms
60,280 KB
testcase_14 AC 136 ms
60,364 KB
testcase_15 AC 136 ms
60,136 KB
testcase_16 AC 135 ms
59,916 KB
testcase_17 AC 137 ms
60,648 KB
testcase_18 AC 136 ms
60,112 KB
testcase_19 AC 136 ms
60,388 KB
testcase_20 AC 135 ms
60,184 KB
testcase_21 AC 136 ms
60,136 KB
testcase_22 AC 135 ms
60,056 KB
testcase_23 AC 136 ms
60,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main0414 {

	public static  void main(String[] args) {
		new Main0414();
	}

	public Main0414() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();	
		System.out.println(solve(s));
	}

	int[][] dp;
	private int solve(String s) {
		dp = new int[1001][1001];
		for(int i=0;i<1001;i++){
			dp[i][0] = 1;
			for(int j=1;j<=i;j++)
				dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % 573; 
		}
		
		int[] count = new int[26];
		for(char c : s.toCharArray())
			count[c-'A']++;
		
		int res = 1;
		int ct = s.length();
		for(int c : count){
			res = (res*dp[ct][c])%573;
			ct -= c;
		}
		
		res = (res+573-1)%573;
		return res;
	}
}
0