結果

問題 No.18 うーさー暗号
ユーザー takosamatakosama
提出日時 2017-12-16 20:21:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 890 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 103,908 KB
実行使用メモリ 23,480 KB
最終ジャッジ日時 2023-09-21 12:55:35
合計ジャッジ時間 3,547 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
21,480 KB
testcase_01 AC 52 ms
23,452 KB
testcase_02 AC 52 ms
21,408 KB
testcase_03 AC 53 ms
21,364 KB
testcase_04 AC 53 ms
23,480 KB
testcase_05 AC 52 ms
21,376 KB
testcase_06 AC 52 ms
21,404 KB
testcase_07 AC 52 ms
21,384 KB
testcase_08 AC 51 ms
19,416 KB
testcase_09 AC 54 ms
23,444 KB
testcase_10 AC 53 ms
21,544 KB
testcase_11 AC 52 ms
23,444 KB
testcase_12 AC 55 ms
21,548 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.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace yukicore
{
    class Program
    {
        //no18
        static void Main(string[] args)
        {
            byte[] strs = Console.ReadLine()
                .ToCharArray()
                .Select(x => (byte) x)
                .Select(x => (byte) (x - 65))
                .ToArray();
            var nums = Enumerable.Range(1, strs.Length).ToArray();

            for (int i = 0; i < strs.Length; i++)
            {
                var tmp = (strs[i] - nums[i]) % 26;
                strs[i] = (byte) (tmp < 0 ? 26 + tmp : tmp);
                strs[i] += 65;
            }
            var rtn = new string(strs.Select(x => (char) x).ToArray());
            Console.WriteLine(rtn);
        }



    }
}
0