結果

問題 No.18 うーさー暗号
ユーザー Salvia0911Salvia0911
提出日時 2023-11-05 22:30:36
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,906 bytes
コンパイル時間 8,935 ms
コンパイル使用メモリ 158,020 KB
実行使用メモリ 174,252 KB
最終ジャッジ日時 2023-11-05 22:30:47
合計ジャッジ時間 11,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
28,696 KB
testcase_01 WA -
testcase_02 AC 54 ms
28,696 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (115 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)
    {
        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 - (shift - 1);

            input[i] = (char)code;
        }
        return input;
    }
}

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