結果

問題 No.423 ハムスター語初級(数詞)
ユーザー tsunabittsunabit
提出日時 2019-06-08 01:15:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 3,583 ms
コンパイル使用メモリ 79,476 KB
実行使用メモリ 54,364 KB
最終ジャッジ日時 2024-04-15 19:28:07
合計ジャッジ時間 5,773 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
54,220 KB
testcase_01 AC 130 ms
54,312 KB
testcase_02 AC 133 ms
54,268 KB
testcase_03 AC 131 ms
54,300 KB
testcase_04 AC 132 ms
54,220 KB
testcase_05 AC 131 ms
54,252 KB
testcase_06 AC 134 ms
54,276 KB
testcase_07 AC 130 ms
54,004 KB
testcase_08 AC 129 ms
54,096 KB
testcase_09 AC 136 ms
54,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class No423 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replace("hamu", "1");
        n = n.replace("ham", "0");
        int dec = Integer.parseInt(n, 2);
        String bin = Integer.toBinaryString(dec * 2);
//        System.out.println(bin);
        bin = bin.replace("1", "hamu");
        bin = bin.replace("0", "ham");
        System.out.println(bin);
    }
}
0