結果

問題 No.18 うーさー暗号
ユーザー 明智重蔵明智重蔵
提出日時 2015-10-24 19:04:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 1,500 bytes
コンパイル時間 3,013 ms
コンパイル使用メモリ 105,884 KB
実行使用メモリ 22,656 KB
最終ジャッジ日時 2023-09-21 11:56:15
合計ジャッジ時間 4,638 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
20,524 KB
testcase_01 AC 53 ms
20,468 KB
testcase_02 AC 52 ms
20,548 KB
testcase_03 AC 51 ms
20,404 KB
testcase_04 AC 52 ms
22,476 KB
testcase_05 AC 52 ms
20,596 KB
testcase_06 AC 51 ms
22,656 KB
testcase_07 AC 53 ms
20,584 KB
testcase_08 AC 51 ms
22,540 KB
testcase_09 AC 51 ms
20,572 KB
testcase_10 AC 51 ms
20,540 KB
testcase_11 AC 51 ms
20,644 KB
testcase_12 AC 51 ms
20,484 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.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("BCD");
            //AAA
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
            //ZZZZZZZZZZZZZZZZZZZZZZZZZZ
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add(new string('Z', 104));
            //YXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCB
            //AZYXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFED
            //CBAZ
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string S = InputList[0];

        var sb = new System.Text.StringBuilder();
        for (int I = 0; I <= S.Length - 1; I++) {
            sb.Append(ZurashiSyori(S[I], I + 1));
        }
        Console.WriteLine(sb.ToString());
    }

    //対象文字を、指定文字分ずらす
    static char ZurashiSyori(char pTarget, int pN)
    {
        while (27 <= pN) pN -= 26;
        char wkChar = (char)(pTarget - pN);
        if ('A' <= wkChar) return wkChar;
        return (char)('Z' - ('A' - wkChar - 1));
    }
}
0