結果

問題 No.327 アルファベット列
ユーザー AoiroFukurou
提出日時 2015-12-26 13:15:54
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 789 bytes
コンパイル時間 3,826 ms
コンパイル使用メモリ 79,920 KB
実行使用メモリ 41,808 KB
最終ジャッジ日時 2024-09-19 00:18:47
合計ジャッジ時間 12,720 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No_327 {
public static void main(String[] args) {
	String[] Alf = {"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"};
	long[] An = new long[20];
	long[] Le = new long[20];
	Scanner sc = new Scanner(System.in);
	long N = sc.nextLong();
	sc.close();
	Long A = N;
	int C = -1;
	String ans = "";
	if(N <= 25){
		ans = Alf[(int)N];
	}else if(N <=701){
		ans+= Alf[((int)N / 26)-1];
		ans+= Alf[(int)N % 26];
	}else{
	while(A>=27){
		A /= 26;
		C++;
	}
	for(int i = 0; i <= C; i++){
		Le[i] = N % 26;
		N /= 26;
	}
	ans+= Alf[(int)N-1];
	for(int i = C; i >= 1; i--){
		ans += Alf[(int)Le[i]-1];
	}
	ans += Alf[(int)Le[0]];
	}
	System.out.println(ans);
		}
}
0