結果
| 問題 |
No.18 うーさー暗号
|
| コンテスト | |
| ユーザー |
aketijyuuzou
|
| 提出日時 | 2024-10-10 21:31:30 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 5,000 ms |
| コード長 | 1,501 bytes |
| コンパイル時間 | 900 ms |
| コンパイル使用メモリ | 114,268 KB |
| 実行使用メモリ | 25,680 KB |
| 最終ジャッジ日時 | 2024-10-10 21:31:32 |
| 合計ジャッジ時間 | 1,815 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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));
}
}
aketijyuuzou