結果

問題 No.423 ハムスター語初級(数詞)
ユーザー GoryudyumaGoryudyuma
提出日時 2017-04-07 20:39:50
言語 Java19
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 2,333 ms
コンパイル使用メモリ 71,772 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-09-23 00:03:53
合計ジャッジ時間 4,113 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,296 KB
testcase_01 AC 120 ms
55,712 KB
testcase_02 AC 118 ms
56,224 KB
testcase_03 AC 117 ms
56,136 KB
testcase_04 AC 119 ms
56,100 KB
testcase_05 AC 120 ms
56,052 KB
testcase_06 AC 119 ms
55,956 KB
testcase_07 AC 118 ms
55,868 KB
testcase_08 AC 117 ms
56,144 KB
testcase_09 AC 115 ms
55,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
        private static int stringtoint(String S){
                return Integer.parseInt(S.replaceAll("hamu", "1").replaceAll("ham", "0"), 2);
        }

        private static String inttostring(int N){
                return Integer.toBinaryString(N).replaceAll("1", "hamu").replaceAll("0", "ham");
        }

        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        System.out.println(inttostring(2*stringtoint(sc.next())));
                }
        }
}
0