結果
問題 |
No.423 ハムスター語初級(数詞)
|
ユーザー |
![]() |
提出日時 | 2018-11-13 22:26:10 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 823 bytes |
コンパイル時間 | 5,001 ms |
コンパイル使用メモリ | 110,072 KB |
実行使用メモリ | 26,388 KB |
最終ジャッジ日時 | 2024-12-24 13:29:12 |
合計ジャッジ時間 | 5,775 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; 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); } }