結果

問題 No.423 ハムスター語初級(数詞)
ユーザー ontama_12ontama_12
提出日時 2016-09-27 18:44:17
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 34 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 38,912 KB
最終ジャッジ日時 2024-04-21 01:31:26
合計ジャッジ時間 1,116 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
38,528 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//入力文字読み取り
var inputall = require('fs').readFileSync('/dev/stdin', 'utf8');


    while (inputall.indexOf("hamu", 0) != -1 && inputall.indexOf("ham", 0) != -1) {
        inputall = inputall.replace("hamu", 1);
        inputall = inputall.replace("ham", 0);
    }

    //数値化
    inputall = Number(inputall);

    //2進数を10進数へ変換
    inputall = parseInt(inputall, 2);

    //10進数を2倍
    inputall = inputall * 2;

    //10進数を2進数へ
    inputall = inputall.toString(2)

    while (inputall.indexOf("1", 0) != -1 && inputall.indexOf("0", 0) != -1) {
        inputall = inputall.replace("1", "hamu");
        inputall = inputall.replace("0", "ham");
    }
    console.log(inputall)
0