結果
問題 | No.423 ハムスター語初級(数詞) |
ユーザー |
|
提出日時 | 2018-04-22 19:57:16 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 2,088 ms |
コンパイル使用メモリ | 73,120 KB |
実行使用メモリ | 37,388 KB |
最終ジャッジ日時 | 2024-06-27 07:03:00 |
合計ジャッジ時間 | 3,286 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main {public static void main(String[] args) throws IOException {BufferedReader br = new BufferedReader(new InputStreamReader(System.in));String humLanguage = br.readLine().replaceAll("hamu", "1").replaceAll("ham", "0");int humNum = Integer.parseInt(humLanguage, 2);String ans = Integer.toBinaryString(humNum * 2);System.out.println(ans.replaceAll("1", "hamu").replaceAll("0", "ham"));br.close();}}