結果

問題 No.18 うーさー暗号
ユーザー huffman56huffman56
提出日時 2022-04-16 21:04:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 1,257 bytes
コンパイル時間 5,508 ms
コンパイル使用メモリ 101,820 KB
実行使用メモリ 22,772 KB
最終ジャッジ日時 2023-08-26 21:01:47
合計ジャッジ時間 5,183 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
22,772 KB
testcase_01 AC 45 ms
20,692 KB
testcase_02 AC 46 ms
20,776 KB
testcase_03 AC 48 ms
20,660 KB
testcase_04 AC 47 ms
22,704 KB
testcase_05 AC 44 ms
20,772 KB
testcase_06 AC 48 ms
20,644 KB
testcase_07 AC 47 ms
20,664 KB
testcase_08 AC 48 ms
20,664 KB
testcase_09 AC 48 ms
20,724 KB
testcase_10 AC 48 ms
20,660 KB
testcase_11 AC 48 ms
20,676 KB
testcase_12 AC 50 ms
22,704 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.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;

namespace yukicoder
{
    class Program
    {
        static void Main()
        {

            // アルファベットを全て管理する変数
            string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            string n = Console.ReadLine().Trim();

            // カウント変数
            int cnt = 0;
            // チェック変数
            int chk = 0;

            // 変換したアルファベットを格納する変数
            string[] ans = new string[n.Length];

            for (int i = 0; i < n.Length; i++)
            {
                chk = s.IndexOf(n[i]);
                // 何番目の文字列か
                int num = i % 26;

                // 該当の文字を格納
                ans[i] =
                    (chk - (num)) <= 0 ?
                        s[chk - (num+1) + 26].ToString() : s[chk - (num+1)].ToString(); 
            }

            Console.WriteLine(String.Join("" , ans));
        }
    }
}
0