結果
| 問題 | No.18 うーさー暗号 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-06-03 14:42:41 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 26 ms / 5,000 ms | 
| コード長 | 1,988 bytes | 
| コンパイル時間 | 792 ms | 
| コンパイル使用メモリ | 108,996 KB | 
| 実行使用メモリ | 25,628 KB | 
| 最終ジャッジ日時 | 2024-09-21 02:18:10 | 
| 合計ジャッジ時間 | 1,737 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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;
            int y = 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+y; 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]);
            }
        }
    }
}
            
            
            
        