結果

問題 No.18 うーさー暗号
ユーザー swdamdrswdamdr
提出日時 2017-01-24 15:11:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 619 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 104,348 KB
実行使用メモリ 16,520 KB
最終ジャッジ日時 2023-09-21 12:35:54
合計ジャッジ時間 3,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
15,336 KB
testcase_01 AC 56 ms
15,396 KB
testcase_02 AC 56 ms
15,516 KB
testcase_03 AC 57 ms
16,520 KB
testcase_04 AC 56 ms
15,520 KB
testcase_05 AC 57 ms
15,552 KB
testcase_06 AC 58 ms
16,012 KB
testcase_07 AC 58 ms
16,132 KB
testcase_08 AC 57 ms
16,340 KB
testcase_09 AC 59 ms
16,008 KB
testcase_10 AC 55 ms
15,400 KB
testcase_11 AC 54 ms
15,520 KB
testcase_12 AC 55 ms
15,752 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;

class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();

        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
        string[] arr = chars.Select(a => a.ToString()).ToArray();
        string ans = "";

        for (int i = 1; i <= s.Length; i++)
        {
            int a = Array.IndexOf(arr, s[i - 1].ToString());
            int b = a - i;

            while (b < 0)
            {
                b = b + 26;
            }

            ans += arr[b];
        }

        Console.WriteLine(ans);
        Console.Read();
    }
}
0