結果

問題 No.327 アルファベット列
ユーザー bluemeganebluemegane
提出日時 2020-09-09 17:26:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 1,194 bytes
コンパイル時間 1,649 ms
コンパイル使用メモリ 67,304 KB
実行使用メモリ 23,540 KB
最終ジャッジ日時 2023-08-22 04:00:19
合計ジャッジ時間 7,755 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
23,360 KB
testcase_01 AC 57 ms
21,324 KB
testcase_02 AC 59 ms
23,440 KB
testcase_03 AC 58 ms
21,436 KB
testcase_04 AC 57 ms
21,436 KB
testcase_05 AC 58 ms
21,364 KB
testcase_06 AC 58 ms
21,428 KB
testcase_07 AC 59 ms
23,420 KB
testcase_08 AC 58 ms
21,444 KB
testcase_09 AC 58 ms
21,388 KB
testcase_10 AC 60 ms
23,352 KB
testcase_11 AC 59 ms
21,500 KB
testcase_12 AC 59 ms
23,372 KB
testcase_13 AC 57 ms
21,496 KB
testcase_14 AC 57 ms
21,404 KB
testcase_15 AC 58 ms
19,560 KB
testcase_16 AC 58 ms
23,416 KB
testcase_17 AC 57 ms
21,520 KB
testcase_18 AC 59 ms
21,452 KB
testcase_19 AC 58 ms
19,428 KB
testcase_20 AC 59 ms
23,356 KB
testcase_21 AC 58 ms
23,404 KB
testcase_22 AC 57 ms
23,376 KB
testcase_23 AC 58 ms
21,368 KB
testcase_24 AC 58 ms
21,504 KB
testcase_25 AC 59 ms
23,540 KB
testcase_26 AC 57 ms
21,308 KB
testcase_27 AC 58 ms
23,416 KB
testcase_28 AC 57 ms
21,460 KB
testcase_29 AC 58 ms
21,308 KB
testcase_30 AC 58 ms
23,480 KB
testcase_31 AC 57 ms
21,368 KB
testcase_32 AC 59 ms
21,368 KB
testcase_33 AC 57 ms
21,364 KB
testcase_34 AC 57 ms
21,456 KB
testcase_35 AC 58 ms
23,492 KB
testcase_36 AC 59 ms
21,512 KB
testcase_37 AC 58 ms
23,452 KB
testcase_38 AC 58 ms
21,360 KB
testcase_39 AC 58 ms
23,372 KB
testcase_40 AC 58 ms
21,412 KB
testcase_41 AC 58 ms
23,372 KB
testcase_42 AC 58 ms
21,360 KB
testcase_43 AC 58 ms
23,316 KB
testcase_44 AC 57 ms
19,320 KB
testcase_45 AC 58 ms
21,420 KB
testcase_46 AC 58 ms
21,472 KB
testcase_47 AC 58 ms
21,488 KB
testcase_48 AC 58 ms
21,324 KB
testcase_49 AC 59 ms
21,336 KB
testcase_50 AC 58 ms
21,452 KB
testcase_51 AC 58 ms
23,468 KB
testcase_52 AC 58 ms
21,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var a = getL(n);
        getAns(a);
    }
    static void getAns(List<int> a)
    {
        var ans = "";
        var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        ans += k[a[0]];
        for (int i = 1; i < a.Count(); i++)
        {
            var x = a[i] - 1 >= 0 ? a[i] - 1 : a[i] + 25;
            ans += k[x];
        }
        var ans2 = ans.ToCharArray();
        Array.Reverse(ans2);
        Console.WriteLine(new string(ans2));
    }
    static List<int> getL(long n)
    {
        var res = new List<int>();
        var t = n;
        res.Add((int)(t % 26));
        t /= 26;
        if (t == 0) return res;
        while (true)
        {
            var x = t % 26;
            if (x == 0)
            {
                res.Add(26);
                t /= 26;
                t--;
                if (t <= 0) break;
            }
            else
            {
            res.Add((int)(t % 26));
            t /= 26;
                if (t <= 0) break;

            }
        }
        return res;
    }
}
0