結果

問題 No.327 アルファベット列
ユーザー spacia
提出日時 2016-06-08 17:20:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 2,981 ms
コンパイル使用メモリ 77,124 KB
実行使用メモリ 41,376 KB
最終ジャッジ日時 2024-10-09 03:12:43
合計ジャッジ時間 10,201 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);

		System.out.println(solve(sc.nextLong()));

		sc.close();

	}

	public static String solve (long n) {

		String[] alp = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
		String ret = alp[(int)(n % 26)];

		long d = 26;
		while (n / d >= 1) {
			int i = (int)(n / d % 26) - 1;
			if (i == -1) i = 25;
			ret = alp[i] + ret;
			n -= d;
			d *= 26;
		}

		return ret;

	}

}
0