結果
| 問題 |
No.423 ハムスター語初級(数詞)
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2016-09-22 22:28:20 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 2,000 ms |
| コード長 | 763 bytes |
| コンパイル時間 | 793 ms |
| コンパイル使用メモリ | 110,556 KB |
| 実行使用メモリ | 25,764 KB |
| 最終ジャッジ日時 | 2024-11-17 13:36:54 |
| 合計ジャッジ時間 | 1,398 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
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);
}
}
norioc