結果
問題 | No.18 うーさー暗号 |
ユーザー |
![]() |
提出日時 | 2015-10-24 19:04:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 1,500 bytes |
コンパイル時間 | 2,264 ms |
コンパイル使用メモリ | 111,572 KB |
実行使用メモリ | 25,688 KB |
最終ジャッジ日時 | 2024-07-07 05:50:52 |
合計ジャッジ時間 | 2,997 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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.Collections.Generic;using System.Linq;class Program{static string InputPattern = "InputX";static List<string> GetInputList(){var WillReturn = new List<string>();if (InputPattern == "Input1") {WillReturn.Add("BCD");//AAA}else if (InputPattern == "Input2") {WillReturn.Add("ABCDEFGHIJKLMNOPQRSTUVWXYZ");//ZZZZZZZZZZZZZZZZZZZZZZZZZZ}else if (InputPattern == "Input3") {WillReturn.Add(new string('Z', 104));//YXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCB//AZYXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFED//CBAZ}else {string wkStr;while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);}return WillReturn;}static void Main(){List<string> InputList = GetInputList();string S = InputList[0];var sb = new System.Text.StringBuilder();for (int I = 0; I <= S.Length - 1; I++) {sb.Append(ZurashiSyori(S[I], I + 1));}Console.WriteLine(sb.ToString());}//対象文字を、指定文字分ずらすstatic char ZurashiSyori(char pTarget, int pN){while (27 <= pN) pN -= 26;char wkChar = (char)(pTarget - pN);if ('A' <= wkChar) return wkChar;return (char)('Z' - ('A' - wkChar - 1));}}