結果

問題 No.327 アルファベット列
ユーザー 明智重蔵明智重蔵
提出日時 2016-06-11 16:32:27
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,481 bytes
コンパイル時間 947 ms
コンパイル使用メモリ 105,728 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-04-17 18:47:10
合計ジャッジ時間 3,673 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
17,408 KB
testcase_01 AC 22 ms
17,920 KB
testcase_02 AC 22 ms
17,792 KB
testcase_03 AC 23 ms
17,920 KB
testcase_04 WA -
testcase_05 AC 22 ms
17,792 KB
testcase_06 WA -
testcase_07 AC 21 ms
17,664 KB
testcase_08 AC 22 ms
17,536 KB
testcase_09 AC 22 ms
17,664 KB
testcase_10 AC 22 ms
17,792 KB
testcase_11 AC 21 ms
17,920 KB
testcase_12 AC 22 ms
17,920 KB
testcase_13 AC 22 ms
17,664 KB
testcase_14 AC 22 ms
17,664 KB
testcase_15 AC 22 ms
17,664 KB
testcase_16 AC 23 ms
17,536 KB
testcase_17 AC 22 ms
17,664 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 AC 23 ms
17,664 KB
testcase_32 RE -
testcase_33 AC 23 ms
17,792 KB
testcase_34 AC 22 ms
17,664 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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());
    }
}
0