結果

問題 No.423 ハムスター語初級(数詞)
ユーザー ぴろずぴろず
提出日時 2016-09-22 22:23:58
言語 Java19
(openjdk 21)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 2,468 ms
コンパイル使用メモリ 71,924 KB
実行使用メモリ 55,960 KB
最終ジャッジ日時 2023-08-11 01:32:14
合計ジャッジ時間 4,427 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,864 KB
testcase_01 AC 118 ms
55,884 KB
testcase_02 AC 119 ms
55,396 KB
testcase_03 AC 119 ms
55,860 KB
testcase_04 AC 117 ms
55,540 KB
testcase_05 AC 118 ms
55,900 KB
testcase_06 AC 118 ms
55,800 KB
testcase_07 AC 119 ms
55,804 KB
testcase_08 AC 119 ms
55,576 KB
testcase_09 AC 116 ms
55,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no423;

import java.util.Scanner;

public class Main {

	//遠回りした
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(encode(2 * decode(sc.next())));
	}
	
	public static long decode(String s) {
		return Long.parseLong(s.replaceAll("hamu", "1").replaceAll("ham", "0"), 2);
	}
	
	public static String encode(long x) {
		return Long.toBinaryString(x).replaceAll("0", "ham").replaceAll("1", "hamu");
	}

}
0