結果

問題 No.18 うーさー暗号
ユーザー k-a-rgbk-a-rgb
提出日時 2023-09-27 14:28:43
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 818 bytes
コンパイル時間 4,976 ms
コンパイル使用メモリ 101,284 KB
実行使用メモリ 22,488 KB
最終ジャッジ日時 2023-09-27 14:28:50
合計ジャッジ時間 3,611 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
22,448 KB
testcase_01 AC 49 ms
20,536 KB
testcase_02 AC 50 ms
20,360 KB
testcase_03 AC 51 ms
22,484 KB
testcase_04 AC 50 ms
22,428 KB
testcase_05 AC 49 ms
20,408 KB
testcase_06 AC 51 ms
20,296 KB
testcase_07 AC 51 ms
20,540 KB
testcase_08 AC 52 ms
20,412 KB
testcase_09 AC 51 ms
22,488 KB
testcase_10 AC 49 ms
20,372 KB
testcase_11 AC 49 ms
18,392 KB
testcase_12 AC 50 ms
22,396 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.Collections.Generic;
using System.Linq;

namespace PracticeAtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
			
			
			//018うーさー暗号
			
			
			//入力
			string sA = Console.ReadLine();
			//int[] after = t.Select(s => int.Parse(s)).ToArray();
			char[] chaA = sA.ToCharArray();
			
			int x = 0;
			int chY = 0;
			
			foreach(char chaB in  chaA){
				
				// 65:A 90:Z 
				x++;
				x= x%26;
				chY = (int)chaB;
				if(chY - x <65){
					chY = chaB +26;
				}
				
				chY = chY - x;
				Console.Write((char)chY); // 出力:97
			
				
			}
			/*
			char c1 = 'a';
			int code1 = (int)c1;
			Console.WriteLine(code1); // 出力:97
			
			int code3 = 99;
			char c3 = (char)code3;
			Console.WriteLine(c3); // 出力:c
			*/
		}
    }
}
0