結果

問題 No.3000 enuemu暗号
ユーザー 14番14番
提出日時 2016-05-29 17:17:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 2,010 bytes
コンパイル時間 945 ms
コンパイル使用メモリ 108,288 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-04-16 18:16:21
合計ジャッジ時間 1,450 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
18,816 KB
testcase_01 AC 30 ms
18,688 KB
testcase_02 AC 30 ms
18,816 KB
testcase_03 AC 31 ms
18,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        this.SetDic();
        string inpt = Reader.ReadLine();
        
        StringBuilder ans = new StringBuilder();
        inpt.ToList().ForEach(a=>ans.Append(dic[a]));
        Console.WriteLine(ans.ToString());

    }
    
    private Dictionary<char, char> dic = new Dictionary<char, char>();
    
    private void SetDic() {
        string src = "pfnovu";
        string dec = "orange";
        for(int i=0; i<src.Length; i++) {
            dic[src[i]] = dec[i];
        }
        src = "axqwuf";
        dec = "cipher";
        for(int i=0; i<src.Length; i++) {
            dic[src[i]] = dec[i];
        }
        
        src = "mbgrihcdejkolsty";
        dec = "bqsuftlmdxynzvwj";
        for(int i=0; i<src.Length; i++) {
            dic[src[i]] = dec[i];
        }
        
        string alpha = "abcdefghijklmnopqrstuvwxyz";
        List<char> keyList = dic.Keys.ToList();
        List<char> valList = dic.Values.ToList();
        
        List<char> keyFusoku =  alpha.Where(a=>!keyList.Contains(a)).ToList();
        List<char> valFusoku = alpha.Where(a=>!valList.Contains(a)).ToList();
        
        dic[keyFusoku[0]] = valFusoku[0];
    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"



mbgrihcdejkolsty



";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0