結果

問題 No.327 アルファベット列
ユーザー GrenacheGrenache
提出日時 2015-12-20 00:33:32
言語 Java19
(openjdk 21)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 1,976 bytes
コンパイル時間 3,918 ms
コンパイル使用メモリ 75,372 KB
実行使用メモリ 49,860 KB
最終ジャッジ日時 2023-07-28 23:02:13
合計ジャッジ時間 8,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
47,340 KB
testcase_01 AC 44 ms
49,280 KB
testcase_02 AC 45 ms
49,372 KB
testcase_03 AC 45 ms
49,196 KB
testcase_04 AC 44 ms
47,396 KB
testcase_05 AC 45 ms
49,456 KB
testcase_06 AC 45 ms
49,848 KB
testcase_07 AC 45 ms
49,352 KB
testcase_08 AC 45 ms
49,448 KB
testcase_09 AC 46 ms
49,420 KB
testcase_10 AC 44 ms
49,300 KB
testcase_11 AC 44 ms
49,364 KB
testcase_12 AC 45 ms
49,572 KB
testcase_13 AC 45 ms
49,476 KB
testcase_14 AC 45 ms
49,400 KB
testcase_15 AC 45 ms
49,460 KB
testcase_16 AC 45 ms
49,368 KB
testcase_17 AC 44 ms
49,356 KB
testcase_18 AC 44 ms
49,388 KB
testcase_19 AC 46 ms
49,368 KB
testcase_20 AC 45 ms
49,444 KB
testcase_21 AC 46 ms
49,860 KB
testcase_22 AC 46 ms
49,680 KB
testcase_23 AC 45 ms
49,328 KB
testcase_24 AC 44 ms
49,292 KB
testcase_25 AC 45 ms
49,292 KB
testcase_26 AC 45 ms
49,344 KB
testcase_27 AC 45 ms
49,356 KB
testcase_28 AC 45 ms
49,464 KB
testcase_29 AC 45 ms
49,292 KB
testcase_30 AC 46 ms
49,276 KB
testcase_31 AC 45 ms
49,340 KB
testcase_32 AC 46 ms
49,200 KB
testcase_33 AC 46 ms
49,400 KB
testcase_34 AC 45 ms
49,200 KB
testcase_35 AC 45 ms
49,532 KB
testcase_36 AC 45 ms
49,376 KB
testcase_37 AC 44 ms
49,304 KB
testcase_38 AC 45 ms
49,472 KB
testcase_39 AC 45 ms
49,552 KB
testcase_40 AC 45 ms
49,332 KB
testcase_41 AC 45 ms
49,272 KB
testcase_42 AC 45 ms
49,192 KB
testcase_43 AC 45 ms
49,356 KB
testcase_44 AC 45 ms
49,420 KB
testcase_45 AC 45 ms
49,324 KB
testcase_46 AC 45 ms
49,196 KB
testcase_47 AC 45 ms
49,356 KB
testcase_48 AC 45 ms
49,356 KB
testcase_49 AC 45 ms
49,564 KB
testcase_50 AC 45 ms
49,416 KB
testcase_51 AC 45 ms
49,520 KB
testcase_52 AC 45 ms
49,464 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