結果
問題 | No.171 スワップ文字列(Med) |
ユーザー |
|
提出日時 | 2015-03-23 00:04:22 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 173 ms / 1,000 ms |
コード長 | 833 bytes |
コンパイル時間 | 2,978 ms |
コンパイル使用メモリ | 77,236 KB |
実行使用メモリ | 43,084 KB |
最終ジャッジ日時 | 2024-06-29 00:17:39 |
合計ジャッジ時間 | 4,882 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
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));}}