結果

問題 No.18 うーさー暗号
ユーザー phsplsphspls
提出日時 2020-03-24 23:17:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 66 ms / 5,000 ms
コード長 796 bytes
コンパイル時間 2,289 ms
コンパイル使用メモリ 107,536 KB
実行使用メモリ 23,704 KB
最終ジャッジ日時 2023-08-30 09:02:27
合計ジャッジ時間 4,408 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
23,496 KB
testcase_01 AC 64 ms
21,588 KB
testcase_02 AC 63 ms
23,704 KB
testcase_03 AC 63 ms
23,592 KB
testcase_04 AC 65 ms
21,548 KB
testcase_05 AC 66 ms
23,700 KB
testcase_06 AC 65 ms
21,480 KB
testcase_07 AC 66 ms
21,552 KB
testcase_08 AC 65 ms
21,364 KB
testcase_09 AC 64 ms
21,436 KB
testcase_10 AC 64 ms
21,568 KB
testcase_11 AC 64 ms
21,608 KB
testcase_12 AC 64 ms
21,560 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.Linq;
using System.Collections.Generic;

public class P0018 {
    public static void Main() {
        char[] s = Console.ReadLine().Trim().ToCharArray();
        char[] alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
        Dictionary<char, int> alphabet2num = Enumerable.Range(0, alphabets.Length).ToDictionary(i => alphabets[i], i => i);
        var result = String.Join(
              ""
            , Enumerable.Range(0, s.Length)
                .Select(i => alphabet2num.GetValueOrDefault(s[i]) - i - 1)
                .Select(i => i % alphabets.Length)
                .Select(i => i + alphabets.Length)
                .Select(i => i % alphabets.Length)
                .Select(i => alphabets[i])
        );
        Console.WriteLine(result);
    }
}
0