結果
問題 |
No.327 アルファベット列
|
ユーザー |
![]() |
提出日時 | 2016-06-11 16:32:27 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,481 bytes |
コンパイル時間 | 856 ms |
コンパイル使用メモリ | 113,512 KB |
実行使用メモリ | 25,972 KB |
最終ジャッジ日時 | 2024-10-09 12:53:27 |
合計ジャッジ時間 | 3,905 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 3 RE * 31 |
コンパイルメッセージ
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; //No.327 アルファベット列 class Program { static string InputPattern = "InputX"; static List<string> GetInputList() { var WillReturn = new List<string>(); if (InputPattern == "Input1") { WillReturn.Add("0"); //A } else if (InputPattern == "Input2") { WillReturn.Add("25"); //Z } else if (InputPattern == "Input3") { WillReturn.Add("26"); //AA } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List<string> InputList = GetInputList(); long N = int.Parse(InputList[0]); //1桁目のAからZ が 0から25に対応 //2桁目のAからZ が 1から26に対応 //3桁目のAからZ が 1から26に対応 //周期は26なので剰余を使う //26進数に変換 var NumList = new List<long>(); do { NumList.Add(N % 26); N /= 26; } while (N > 0); var sb = new System.Text.StringBuilder(); for (int I = NumList.Count - 1; 0 <= I; I--) { char wkChar = (char)('A' + (char)NumList[I]); if (I > 0) wkChar--; sb.Append(wkChar); } Console.WriteLine(sb.ToString()); } }