結果
問題 | No.171 スワップ文字列(Med) |
ユーザー |
![]() |
提出日時 | 2015-03-22 23:47:35 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 614 bytes |
コンパイル時間 | 2,096 ms |
コンパイル使用メモリ | 81,584 KB |
実行使用メモリ | 56,944 KB |
最終ジャッジ日時 | 2024-06-29 00:15:40 |
合計ジャッジ時間 | 4,335 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 3 |
ソースコード
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))+"")); } System.out.println(ans.mod(new BigInteger("573")).subtract(new BigInteger("1"))); } }