結果
問題 | No.171 スワップ文字列(Med) |
ユーザー | kou6839 |
提出日時 | 2015-03-22 23:50:25 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 176 ms / 1,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 2,272 ms |
コンパイル使用メモリ | 76,168 KB |
実行使用メモリ | 58,684 KB |
最終ジャッジ日時 | 2023-09-11 09:37:29 |
合計ジャッジ時間 | 4,928 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
55,668 KB |
testcase_01 | AC | 119 ms
56,280 KB |
testcase_02 | AC | 139 ms
55,704 KB |
testcase_03 | AC | 121 ms
56,044 KB |
testcase_04 | AC | 124 ms
55,512 KB |
testcase_05 | AC | 149 ms
55,892 KB |
testcase_06 | AC | 145 ms
56,364 KB |
testcase_07 | AC | 146 ms
56,212 KB |
testcase_08 | AC | 176 ms
56,840 KB |
testcase_09 | AC | 176 ms
58,684 KB |
testcase_10 | AC | 118 ms
53,656 KB |
testcase_11 | AC | 118 ms
55,860 KB |
testcase_12 | AC | 118 ms
56,028 KB |
ソースコード
import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String a = sc.next(); HashMap<Character, Integer> set = new HashMap<>(); BigInteger ans = new BigInteger("1"); for(int i=0;i<a.length();i++){ if(set.get(a.charAt(i))==null) { set.put(a.charAt(i),0); } set.put(a.charAt(i),set.get(a.charAt(i))+1); ans=ans.multiply(new BigInteger(i+1+"")); ans=ans.divide(new BigInteger(set.get(a.charAt(i))+"")); } ans=ans.subtract(new BigInteger("1")); ans=ans.mod(new BigInteger("573")); System.out.println(ans); } }