結果
問題 | No.423 ハムスター語初級(数詞) |
ユーザー |
|
提出日時 | 2017-08-15 22:11:14 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 1,150 bytes |
コンパイル時間 | 2,316 ms |
コンパイル使用メモリ | 112,616 KB |
実行使用メモリ | 25,988 KB |
最終ジャッジ日時 | 2024-10-13 11:03:39 |
合計ジャッジ時間 | 1,708 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections.Generic;using System.Linq;public class yukicoder{public static int hamtodecimal(string s){string[] ham = s.Split(new String[]{"ha"}, StringSplitOptions.RemoveEmptyEntries);for(int i = 0; i < ham.Length; i++){if(ham[i] == "mu"){ham[i] = "1";}else if(ham[i] == "m"){ham[i] = "0";}}return Convert.ToInt32(String.Join(null, ham), 2);}public static string decimaltoham(int n){string s = Convert.ToString(n, 2);List<String> ham = new List<String>();foreach(char c in s){if(c == '1'){ham.Add("hamu");}else if(c == '0'){ham.Add("ham");}}return String.Join(null, ham);}public static void Main(){int n = hamtodecimal(Console.ReadLine()) * 2;Console.WriteLine(decimaltoham(n));}}