結果

問題 No.327 アルファベット列
ユーザー GrenacheGrenache
提出日時 2015-12-20 00:33:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 1,976 bytes
コンパイル時間 4,116 ms
コンパイル使用メモリ 78,908 KB
実行使用メモリ 37,340 KB
最終ジャッジ日時 2024-04-16 06:59:13
合計ジャッジ時間 8,269 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
37,184 KB
testcase_01 AC 54 ms
37,304 KB
testcase_02 AC 56 ms
37,052 KB
testcase_03 AC 54 ms
37,156 KB
testcase_04 AC 53 ms
37,120 KB
testcase_05 AC 52 ms
36,888 KB
testcase_06 AC 53 ms
37,100 KB
testcase_07 AC 51 ms
37,244 KB
testcase_08 AC 54 ms
37,120 KB
testcase_09 AC 51 ms
37,188 KB
testcase_10 AC 51 ms
36,692 KB
testcase_11 AC 53 ms
37,052 KB
testcase_12 AC 52 ms
36,780 KB
testcase_13 AC 53 ms
37,120 KB
testcase_14 AC 54 ms
37,032 KB
testcase_15 AC 54 ms
36,888 KB
testcase_16 AC 54 ms
37,052 KB
testcase_17 AC 55 ms
37,156 KB
testcase_18 AC 53 ms
37,016 KB
testcase_19 AC 54 ms
37,080 KB
testcase_20 AC 53 ms
36,888 KB
testcase_21 AC 53 ms
37,112 KB
testcase_22 AC 52 ms
36,800 KB
testcase_23 AC 58 ms
37,024 KB
testcase_24 AC 53 ms
36,824 KB
testcase_25 AC 51 ms
36,956 KB
testcase_26 AC 52 ms
37,016 KB
testcase_27 AC 54 ms
37,032 KB
testcase_28 AC 54 ms
37,032 KB
testcase_29 AC 54 ms
37,120 KB
testcase_30 AC 54 ms
37,340 KB
testcase_31 AC 54 ms
37,188 KB
testcase_32 AC 54 ms
37,068 KB
testcase_33 AC 54 ms
37,024 KB
testcase_34 AC 53 ms
37,224 KB
testcase_35 AC 53 ms
37,120 KB
testcase_36 AC 53 ms
37,016 KB
testcase_37 AC 52 ms
37,216 KB
testcase_38 AC 53 ms
36,980 KB
testcase_39 AC 53 ms
37,228 KB
testcase_40 AC 52 ms
36,888 KB
testcase_41 AC 53 ms
36,980 KB
testcase_42 AC 53 ms
36,980 KB
testcase_43 AC 54 ms
36,692 KB
testcase_44 AC 54 ms
37,096 KB
testcase_45 AC 55 ms
36,980 KB
testcase_46 AC 53 ms
36,976 KB
testcase_47 AC 53 ms
37,128 KB
testcase_48 AC 54 ms
36,980 KB
testcase_49 AC 55 ms
37,160 KB
testcase_50 AC 53 ms
36,924 KB
testcase_51 AC 56 ms
36,980 KB
testcase_52 AC 55 ms
36,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Iterator;


public class Main_yukicoder327 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        char[] a = new char[26];
        for (char c = 'A'; c <= 'Z'; c++) {
        	a[c - 'A'] = c;
        }

        long n = sc.nextLong();

        Deque<Character> st = new ArrayDeque<Character>();
    	st.push(a[(int)(n % 26)]);
    	n /= 26;
        while (n > 0) {
        	n = n - 1;
        	st.push(a[(int)(n % 26)]);
        	n /= 26;
        }

        for (char c : st) {
        	pr.print(c);
        }
        pr.println();

        pr.close();
        sc.close();
    }

    @SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0