結果

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

ソースコード

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[] 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 if(N >= 1352 && N <= 1377){
		ans += Alf[0];
		ans += Alf[25];
		ans += Alf[(int)N % 52];
	}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