結果

問題 No.18 うーさー暗号
ユーザー Salvia0911Salvia0911
提出日時 2023-11-05 22:49:21
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 2,004 bytes
コンパイル時間 8,147 ms
コンパイル使用メモリ 156,888 KB
実行使用メモリ 173,640 KB
最終ジャッジ日時 2023-11-05 22:49:32
合計ジャッジ時間 10,615 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
28,768 KB
testcase_01 AC 55 ms
28,768 KB
testcase_02 AC 54 ms
28,776 KB
testcase_03 AC 55 ms
28,784 KB
testcase_04 AC 56 ms
28,776 KB
testcase_05 AC 56 ms
28,776 KB
testcase_06 AC 54 ms
28,784 KB
testcase_07 AC 54 ms
28,784 KB
testcase_08 AC 55 ms
28,784 KB
testcase_09 AC 54 ms
28,784 KB
testcase_10 AC 55 ms
28,776 KB
testcase_11 AC 55 ms
28,776 KB
testcase_12 AC 56 ms
173,640 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (105 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;

public class InputStrorage
{
    public char[] encrypted;
}

public static class InputHandler
{
    public static void ReadInput(InputStrorage input)
    {
        string str = Console.ReadLine();
        input.encrypted = str.ToCharArray();
    }
}

namespace GeneralLibs
{
    public class Compare
    {
        public static long ReturnMax(long a, long b)
        {
            if (a > b) return a;
            else return b;
        }

        public static long ReturnMax(long[] a)
        {
            long max = long.MinValue;
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] > max) max = a[i];
            }
            return max;
        }
    }

    public class ShowValues
    {
        public static void ShowArray1D(long[] a, string str = "default")
        {
            Console.WriteLine(str);
            for (int i = 0; i < a.Length; i++)
            {
                Console.Write("{0} ", a[i]);
            }
            Console.WriteLine();
            Console.WriteLine(str);
        }

        public static void ShowValue(long a, string str = "default")
        {
            Console.WriteLine("{0} : {1}", a, str);
        }
    }
}

public class SpecificLibs
{
    public static char[] DecryptString(char[] input)
    {
        char[] result = new char[input.Length];

        for(int i = 0; i < input.Length; i++)
        {
            int shift = (i + 1) % 26;
            int code = (int)input[i];

            code -= shift;
            if (code < 65)
            {
                code = 90 - (65 - code - 1);
            }
            result[i] = (char)code;
        }
        return result;
    }
}

static class No18
{
    static void Main()
    {
        InputStrorage input = new InputStrorage();
        InputHandler.ReadInput(input);

        //A=65, Z = 90;
        string ans = new string (SpecificLibs.DecryptString(input.encrypted));
        Console.WriteLine(ans);
    }
}
0