結果

問題 No.423 ハムスター語初級(数詞)
ユーザー swdamdrswdamdr
提出日時 2017-01-26 14:18:21
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 950 bytes
コンパイル時間 2,207 ms
コンパイル使用メモリ 104,240 KB
実行使用メモリ 22,564 KB
最終ジャッジ日時 2023-08-25 00:00:21
合計ジャッジ時間 3,446 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
22,564 KB
testcase_01 AC 51 ms
20,612 KB
testcase_02 AC 51 ms
20,584 KB
testcase_03 RE -
testcase_04 AC 51 ms
20,648 KB
testcase_05 RE -
testcase_06 AC 51 ms
20,600 KB
testcase_07 RE -
testcase_08 AC 51 ms
20,560 KB
testcase_09 AC 52 ms
22,512 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        string str = "";
        string num = "";

        while (s.Length > 0)
        {
            str = s.Substring(0, 4);

            if (str[3] == 'u')
            {
                num += "1";
                s = s.Remove(0, 4);
            }
            else
            {
                num += "0";
                s = s.Remove(0, 3);
            }
        }

        int no = Convert.ToInt32(num, 2);
        no *= 2;

        num = Convert.ToString(no, 2);
        str = "";

        for (int i = 0; i < num.Length; i++)
        {
            if (num[i] == '1')
            {
                str += "hamu";
            }
            else
            {
                str += "ham";
            }
        }

        Console.WriteLine(str);
        Console.Read();
    }
}

0