結果
| 問題 |
No.423 ハムスター語初級(数詞)
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-09-25 15:57:18 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,002 bytes |
| コンパイル時間 | 811 ms |
| コンパイル使用メモリ | 109,492 KB |
| 実行使用メモリ | 26,716 KB |
| 最終ジャッジ日時 | 2024-11-18 12:26:26 |
| 合計ジャッジ時間 | 1,547 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 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 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;
}
}
mban