結果

問題 No.423 ハムスター語初級(数詞)
ユーザー atkrymatkrym
提出日時 2016-10-18 11:41:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 71,860 KB
実行使用メモリ 56,196 KB
最終ジャッジ日時 2023-08-14 14:23:29
合計ジャッジ時間 4,017 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,824 KB
testcase_01 AC 115 ms
56,196 KB
testcase_02 AC 118 ms
55,404 KB
testcase_03 AC 118 ms
55,412 KB
testcase_04 AC 116 ms
55,624 KB
testcase_05 AC 118 ms
55,940 KB
testcase_06 AC 117 ms
55,928 KB
testcase_07 AC 120 ms
55,924 KB
testcase_08 AC 121 ms
56,064 KB
testcase_09 AC 117 ms
56,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        s = s.replace("hamu", "1");
        s = s.replace("ham", "0");
        
        int ret = Integer.parseInt(s, 2)*2;
        
        s = Integer.toBinaryString(ret);
        
        s = s.replace("1", "hamu");
        s = s.replace("0", "ham");
        
        System.out.println(s);
    }
}
0