結果

問題 No.423 ハムスター語初級(数詞)
ユーザー bayashiko_rbayashiko_r
提出日時 2018-11-13 22:26:10
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 823 bytes
コンパイル時間 3,762 ms
コンパイル使用メモリ 102,920 KB
実行使用メモリ 24,704 KB
最終ジャッジ日時 2023-08-26 00:55:51
合計ジャッジ時間 5,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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;

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();
        

        //文字列の中から、hamuとhamを数字に置き換えていく
        string s_after = s.Replace("hamu", "1");
        s_after = s_after.Replace("ham", "0");

        //2進数→10進数に変換する
        int t_decimal = Convert.ToInt32(s_after, 2);

        Console.WriteLine(t_decimal);

        //2倍する
        t_decimal *= 2;

        //2進数に変換する
        string ans = Convert.ToString(t_decimal, 2);

        //文字列の中から、0と1をhamu/hamに置き換えていく
        string ans_after = ans.Replace("1", "hamu");
        ans_after = ans_after.Replace("0", "ham");

        //出力
        Console.WriteLine(ans_after);
    }
}
0