結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
kenji_shioya
|
| 提出日時 | 2016-06-17 17:47:12 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 3,475 ms |
| コンパイル使用メモリ | 75,248 KB |
| 実行使用メモリ | 54,456 KB |
| 最終ジャッジ日時 | 2024-10-09 16:52:33 |
| 合計ジャッジ時間 | 7,603 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 14 WA * 7 |
ソースコード
import java.util.*;
public class Exercise93{
public static void main (String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.next();
int baseR = getRoutes(str.length());
ArrayList<Integer> s = new ArrayList<Integer>();
for(int i = 0; i < str.length(); i++){
int count = 1;
for (int j = i + 1; j < str.length(); j++){
if(str.charAt(i) == str.charAt(j)){
count++;
}
}
if(count > 0){
s.add(count);
}
}
int sameR = 1;
for(int i = 0; i < s.size(); i++){
sameR *= getRoutes(s.get(i));
}
System.out.println(baseR / sameR - 1);
}
private static int getRoutes(int num){
int r = 1;
for (int i = 0; i < num; i++){
r *= num - i;
}
return r;
}
}
kenji_shioya