結果

問題 No.18 うーさー暗号
ユーザー n.yn.y
提出日時 2022-06-03 14:36:25
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,953 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 108,488 KB
実行使用メモリ 23,528 KB
最終ジャッジ日時 2023-10-21 01:28:24
合計ジャッジ時間 1,859 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
23,528 KB
testcase_01 AC 23 ms
23,528 KB
testcase_02 AC 23 ms
23,528 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 25 ms
23,528 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 24 ms
23,528 KB
testcase_12 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Diagnostics;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //文字列入力
            string S = Console.ReadLine();

            string[] a = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
            //入力した配列
            string[] s = new string[S.Length];

            //文字列の一部分の取得
            for (int i = 0; i < S.Length; i++)
            {
                string str = S.Substring(i, 1);
                s[i] = str;
            }

            //26を何回するか
            int x = S.Length / 26;

            //一文字とる 
            for (int i=1;i<=S.Length;i++)
            {
                for (int j = 1; j <= a.Length; j++)
                {
                    //アルファベットから数値にする
                    if (s[i - 1] == a[j-1])
                    {
                        //数値求める
                        int c = j - i;
                        //26足す回数
                        for (int k = 0; k < x; k++)
                        {
                            if (c <= 0)
                            {
                                c += 26;
                            }
                            if(c>0&&c>=26)
                            {
                                break;
                            }
                        }
                        //数値の数だけアルファベット移動させる,
                        s[i - 1] = a[c-1];
                        Debug.WriteLine(s[i - 1]);
                        break;
                    }


                }
                
            }
            //表示
            for (int i = 1; i <= S.Length; i++)
            {
                Console.Write(s[i-1]);

            }

        }
    }
}
0