結果
問題 |
No.423 ハムスター語初級(数詞)
|
ユーザー |
|
提出日時 | 2017-01-26 14:18:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 950 bytes |
コンパイル時間 | 1,121 ms |
コンパイル使用メモリ | 112,068 KB |
実行使用メモリ | 25,936 KB |
最終ジャッジ日時 | 2024-12-23 11:39:15 |
合計ジャッジ時間 | 1,647 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 RE * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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(); } }