結果
| 問題 |
No.52 よくある文字列の問題
|
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-02-06 16:34:52 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 179 ms / 5,000 ms |
| コード長 | 587 bytes |
| コンパイル時間 | 2,125 ms |
| コンパイル使用メモリ | 77,388 KB |
| 実行使用メモリ | 55,472 KB |
| 最終ジャッジ日時 | 2024-09-22 05:19:31 |
| 合計ジャッジ時間 | 4,598 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
import java.math.*;
import java.util.*;
public class Main {
static Set<String> ans;
static void dfs(String to,String moto){
if(moto.equals("")){
ans.add(to);
return;
}
String temp = to + moto.charAt(0);
dfs(temp, moto.substring(1,moto.length()));
temp=to+moto.charAt(moto.length()-1);
dfs(temp, moto.substring(0,moto.length()-1));
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ans=new HashSet<>();
String string = sc.next();
dfs("", string);
System.out.println(ans.size());
}
}
kou6839