結果

問題 No.52 よくある文字列の問題
ユーザー kano_townkano_town
提出日時 2014-11-19 22:10:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 185 ms / 5,000 ms
コード長 555 bytes
コンパイル時間 3,968 ms
コンパイル使用メモリ 87,788 KB
実行使用メモリ 58,596 KB
最終ジャッジ日時 2023-10-22 03:57:30
合計ジャッジ時間 6,647 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
58,368 KB
testcase_01 AC 168 ms
58,388 KB
testcase_02 AC 177 ms
58,492 KB
testcase_03 AC 164 ms
58,472 KB
testcase_04 AC 185 ms
58,596 KB
testcase_05 AC 183 ms
56,548 KB
testcase_06 AC 182 ms
58,548 KB
testcase_07 AC 167 ms
58,416 KB
testcase_08 AC 171 ms
58,360 KB
testcase_09 AC 160 ms
58,340 KB
testcase_10 AC 158 ms
58,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;

public class Yukicoder52 {

	static HashSet hash = new HashSet();
	static String s = "";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		s = sc.next();

		check("", 0, s.length()-1);
		System.out.println(hash.size());
	}

	static void check(String pat, int nowS, int nowE) {
		if (pat.length() == s.length()) {
			hash.add(pat);
			return;
		}
		check(pat + s.charAt(nowS), nowS+1, nowE);
		check(pat + s.charAt(nowE), nowS, nowE-1);
		
	}
}
0