結果

問題 No.327 アルファベット列
ユーザー crazybbb3crazybbb3
提出日時 2016-11-28 21:25:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 1,967 bytes
コンパイル時間 3,386 ms
コンパイル使用メモリ 80,016 KB
実行使用メモリ 54,012 KB
最終ジャッジ日時 2023-08-18 08:54:39
合計ジャッジ時間 9,268 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
52,708 KB
testcase_01 AC 78 ms
52,876 KB
testcase_02 AC 79 ms
53,224 KB
testcase_03 AC 78 ms
52,516 KB
testcase_04 AC 84 ms
52,592 KB
testcase_05 AC 79 ms
53,104 KB
testcase_06 AC 77 ms
52,760 KB
testcase_07 AC 78 ms
51,196 KB
testcase_08 AC 85 ms
52,736 KB
testcase_09 AC 84 ms
52,908 KB
testcase_10 AC 80 ms
52,500 KB
testcase_11 AC 79 ms
53,276 KB
testcase_12 AC 82 ms
52,504 KB
testcase_13 AC 81 ms
52,796 KB
testcase_14 AC 84 ms
53,116 KB
testcase_15 AC 82 ms
52,656 KB
testcase_16 AC 81 ms
52,528 KB
testcase_17 AC 92 ms
52,804 KB
testcase_18 AC 80 ms
52,516 KB
testcase_19 AC 82 ms
53,460 KB
testcase_20 AC 83 ms
53,460 KB
testcase_21 AC 83 ms
52,676 KB
testcase_22 AC 82 ms
53,744 KB
testcase_23 AC 85 ms
53,456 KB
testcase_24 AC 82 ms
53,536 KB
testcase_25 AC 84 ms
53,652 KB
testcase_26 AC 82 ms
52,860 KB
testcase_27 AC 83 ms
53,752 KB
testcase_28 AC 84 ms
51,196 KB
testcase_29 AC 86 ms
53,748 KB
testcase_30 AC 90 ms
52,560 KB
testcase_31 AC 78 ms
52,976 KB
testcase_32 AC 83 ms
53,464 KB
testcase_33 AC 88 ms
52,900 KB
testcase_34 AC 77 ms
52,500 KB
testcase_35 AC 79 ms
51,408 KB
testcase_36 AC 88 ms
53,568 KB
testcase_37 AC 85 ms
53,480 KB
testcase_38 AC 85 ms
53,480 KB
testcase_39 AC 90 ms
53,868 KB
testcase_40 AC 86 ms
53,508 KB
testcase_41 AC 80 ms
51,352 KB
testcase_42 AC 83 ms
52,860 KB
testcase_43 AC 84 ms
54,012 KB
testcase_44 AC 91 ms
53,580 KB
testcase_45 AC 83 ms
51,196 KB
testcase_46 AC 80 ms
53,576 KB
testcase_47 AC 83 ms
53,220 KB
testcase_48 AC 84 ms
52,800 KB
testcase_49 AC 80 ms
52,496 KB
testcase_50 AC 84 ms
53,484 KB
testcase_51 AC 83 ms
53,092 KB
testcase_52 AC 83 ms
53,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        long n = nl();

        n++;

        ArrayList<Integer> list = new ArrayList<>();

        while (n > 0) {
            n--;
            list.add((int)(n % 26));
            n /= 26;
        }

        String ans = "";
        for (int i = 0; i < list.size(); i++) {
            ans = (char)('A' + list.get(i)) + ans;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0