結果

問題 No.327 アルファベット列
ユーザー spacia
提出日時 2016-06-08 17:18:30
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 563 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 76,508 KB
実行使用メモリ 56,336 KB
最終ジャッジ日時 2024-10-09 03:12:26
合計ジャッジ時間 9,046 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 9 RE * 19
権限があれば一括ダウンロードができます

ソースコード

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