結果
問題 | No.423 ハムスター語初級(数詞) |
ユーザー | bayashiko_r |
提出日時 | 2018-11-13 22:26:55 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 784 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 94,564 KB |
実行使用メモリ | 22,688 KB |
最終ジャッジ日時 | 2023-08-26 00:55:54 |
合計ジャッジ時間 | 3,263 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
20,444 KB |
testcase_01 | AC | 46 ms
22,688 KB |
testcase_02 | AC | 47 ms
22,476 KB |
testcase_03 | AC | 46 ms
20,648 KB |
testcase_04 | AC | 47 ms
20,688 KB |
testcase_05 | AC | 46 ms
18,392 KB |
testcase_06 | AC | 50 ms
18,576 KB |
testcase_07 | AC | 48 ms
20,504 KB |
testcase_08 | AC | 46 ms
20,608 KB |
testcase_09 | AC | 45 ms
18,616 KB |
コンパイルメッセージ
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); //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); } }