結果
問題 | No.52 よくある文字列の問題 |
ユーザー |
|
提出日時 | 2020-02-18 10:44:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 208 ms / 5,000 ms |
コード長 | 688 bytes |
コンパイル時間 | 2,735 ms |
コンパイル使用メモリ | 86,532 KB |
実行使用メモリ | 43,596 KB |
最終ジャッジ日時 | 2024-10-06 15:25:30 |
合計ジャッジ時間 | 5,909 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; class Main { public static void main(String[] args) throws Exception { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); char[] cs=sc.next().toCharArray(); HashSet<String> set=new HashSet<>(); for(int s=0;s<1<<cs.length;++s) { int L=0,R=cs.length; String str=""; for(int shift=0;shift<cs.length;++shift) { if((s>>shift)%2==1) { str+=cs[L]; ++L; }else { str+=cs[R-1]; --R; } } set.add(str); } System.out.println(set.size()); } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }