結果

問題 No.18 うーさー暗号
ユーザー aketijyuuzouaketijyuuzou
提出日時 2024-10-10 21:31:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 1,501 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 114,268 KB
実行使用メモリ 25,680 KB
最終ジャッジ日時 2024-10-10 21:31:32
合計ジャッジ時間 1,815 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
23,468 KB
testcase_01 AC 23 ms
23,728 KB
testcase_02 AC 24 ms
25,628 KB
testcase_03 AC 24 ms
25,544 KB
testcase_04 AC 24 ms
23,540 KB
testcase_05 AC 24 ms
23,544 KB
testcase_06 AC 24 ms
23,292 KB
testcase_07 AC 23 ms
23,464 KB
testcase_08 AC 23 ms
23,800 KB
testcase_09 AC 24 ms
25,680 KB
testcase_10 AC 24 ms
25,560 KB
testcase_11 AC 23 ms
23,596 KB
testcase_12 AC 24 ms
23,476 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