using System; using System.Collections.Generic; using System.Linq; //No.327 アルファベット列 class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); 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 InputList = GetInputList(); long N = long.Parse(InputList[0]); Solve(N); } static void Solve(long pN) { long ZentaiBanme = pN + 1; //全体の何番目を求めるか //群ごとの項数を求める long CurrGunCnt = 26; var GunKousuuList = new List(); while (true) { GunKousuuList.Add(CurrGunCnt); if (GunKousuuList.Sum() > ZentaiBanme) break; CurrGunCnt *= 26; } long RunSum = 0; long GunBanme = ZentaiBanme; //対象群の何番目を求めるか long TargetGunLength = 1; for (int I = 0; I <= GunKousuuList.Count - 1; I++) { RunSum += GunKousuuList[I]; if (ZentaiBanme <= RunSum) { TargetGunLength = I + 1; break; } GunBanme -= GunKousuuList[I]; } long TargetNum = GunBanme - 1; var NumList = new List(); do { NumList.Add(TargetNum % 26); TargetNum /= 26; } while (TargetNum > 0); while (NumList.Count < TargetGunLength) NumList.Add(0); NumList.Reverse(); var sb = new System.Text.StringBuilder(); int UB = NumList.Count - 1; for (int I = 0; I <= UB; I++) { char wkChar = (char)('A' + (char)NumList[I]); sb.Append(wkChar); } Console.WriteLine(sb.ToString()); } }