結果

問題 No.423 ハムスター語初級(数詞)
ユーザー noriocnorioc
提出日時 2016-09-22 22:28:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 1,985 ms
コンパイル使用メモリ 102,764 KB
実行使用メモリ 22,656 KB
最終ジャッジ日時 2023-08-11 01:36:15
合計ジャッジ時間 3,214 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
22,612 KB
testcase_01 AC 53 ms
22,560 KB
testcase_02 AC 52 ms
20,472 KB
testcase_03 AC 52 ms
20,556 KB
testcase_04 AC 53 ms
22,656 KB
testcase_05 AC 52 ms
20,576 KB
testcase_06 AC 53 ms
20,592 KB
testcase_07 AC 53 ms
20,580 KB
testcase_08 AC 52 ms
20,488 KB
testcase_09 AC 52 ms
18,532 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.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static string ToHam(int n) {
        var bin = Convert.ToString(n, 2);
        return bin.Replace("1", "hamu").Replace("0", "ham");
    }

    static int ToInt(string ham) {
        var s = ham.Replace("hamu", "1").Replace("ham", "0");
        return Convert.ToInt32(s, 2);
    }

    static void Main() {
        var s = Console.ReadLine();
        int n = ToInt(s);
        var ans = ToHam(n * 2);
        Console.WriteLine(ans);
    }
}
0