結果

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

テストケース

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

ソースコード

diff #

///////////////////////////////// No.423 ハムスター語初級(数詞)

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

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

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

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

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

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

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