結果
問題 | No.423 ハムスター語初級(数詞) |
ユーザー |
|
提出日時 | 2017-03-30 22:34:15 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 2,749 ms |
コンパイル使用メモリ | 74,972 KB |
実行使用メモリ | 54,000 KB |
最終ジャッジ日時 | 2024-07-07 03:14:10 |
合計ジャッジ時間 | 4,372 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import java.util.Scanner; public class Hamgo { public static void main(String[] args) { Scanner s = new Scanner(System.in); String n = s.nextLine(); s.close(); n = n.replaceAll("hamu", "1"); n = n.replaceAll("ham", "0"); int k = 2 * Integer.parseUnsignedInt(n, 2); n = Integer.toBinaryString(k); StringBuilder ans = new StringBuilder(); for(int i = 0;i < n.length();i++){ if(n.charAt(i) == '1'){ ans.append("hamu"); }else{ ans.append("ham"); } } System.out.println(ans); } }