結果
問題 | No.18 うーさー暗号 |
ユーザー | phspls |
提出日時 | 2020-03-24 23:17:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 1,058 ms |
コンパイル使用メモリ | 117,092 KB |
実行使用メモリ | 27,608 KB |
最終ジャッジ日時 | 2025-01-01 18:54:22 |
合計ジャッジ時間 | 2,280 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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.Linq; using System.Collections.Generic; public class P0018 { public static void Main() { char[] s = Console.ReadLine().Trim().ToCharArray(); char[] alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); Dictionary<char, int> alphabet2num = Enumerable.Range(0, alphabets.Length).ToDictionary(i => alphabets[i], i => i); var result = String.Join( "" , Enumerable.Range(0, s.Length) .Select(i => alphabet2num.GetValueOrDefault(s[i]) - i - 1) .Select(i => i % alphabets.Length) .Select(i => i + alphabets.Length) .Select(i => i % alphabets.Length) .Select(i => alphabets[i]) ); Console.WriteLine(result); } }