結果
| 問題 | 
                            No.423 ハムスター語初級(数詞)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bayashiko_r
                         | 
                    
| 提出日時 | 2018-11-13 22:26:55 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 22 ms / 2,000 ms | 
| コード長 | 784 bytes | 
| コンパイル時間 | 874 ms | 
| コンパイル使用メモリ | 102,912 KB | 
| 実行使用メモリ | 17,792 KB | 
| 最終ジャッジ日時 | 2024-12-24 13:29:15 | 
| 合計ジャッジ時間 | 1,588 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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;
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);
    }
}
            
            
            
        
            
bayashiko_r