結果

問題 No.423 ハムスター語初級(数詞)
ユーザー mbanmban
提出日時 2016-09-25 15:57:18
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,002 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 113,812 KB
実行使用メモリ 28,592 KB
最終ジャッジ日時 2024-04-29 09:51:08
合計ジャッジ時間 1,735 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Magatro {
    static Dictionary<string,int> HamDic = new Dictionary<string, int>();
    static string[] IntHum = { "ham", "hamu" };
    static void Main() {
        for(int i = 0; i < 2; i++) {
            HamDic.Add(IntHum[i], i);
        }
        string n = Console.ReadLine();
        Console.WriteLine(tohum(2 * Toint(n)));
    }
static int Toint(string hum) {
        hum = hum.Replace(IntHum[1], "1");
        hum = hum.Replace(IntHum[0], "0");
        //return int.Parse(hum);
        int ret = 0;
        for(int i = 0; i < hum.Length; i++) {
            if (hum[hum.Length - 1 - i] == '1') {
                ret += (int)Math.Pow(2, i);
            }
        }
        return ret;
    }
    static string tohum(int n) {
        //Console.WriteLine(n);
        string s = Convert.ToString(n, 2);
        s=s.Replace("1", "humu");
       s= s.Replace("0", "hum");
      //  Console.WriteLine(s);
        return s;
    }
}
0