結果
問題 | No.171 スワップ文字列(Med) |
ユーザー |
![]() |
提出日時 | 2015-03-22 23:50:25 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 158 ms / 1,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 1,978 ms |
コンパイル使用メモリ | 77,988 KB |
実行使用メモリ | 42,992 KB |
最終ジャッジ日時 | 2024-06-29 00:15:58 |
合計ジャッジ時間 | 4,220 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
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); } }