結果

問題 No.423 ハムスター語初級(数詞)
ユーザー ぴろず
提出日時 2016-09-22 22:23:58
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 74,264 KB
実行使用メモリ 41,432 KB
最終ジャッジ日時 2024-11-17 13:32:28
合計ジャッジ時間 3,371 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

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