結果

問題 No.327 アルファベット列
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-01-04 16:42:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 856 bytes
コンパイル時間 3,504 ms
コンパイル使用メモリ 77,576 KB
実行使用メモリ 57,744 KB
最終ジャッジ日時 2023-10-19 15:04:25
合計ジャッジ時間 12,258 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
57,020 KB
testcase_01 AC 136 ms
57,464 KB
testcase_02 WA -
testcase_03 AC 138 ms
57,500 KB
testcase_04 AC 137 ms
57,472 KB
testcase_05 AC 136 ms
57,092 KB
testcase_06 AC 137 ms
57,008 KB
testcase_07 AC 135 ms
57,520 KB
testcase_08 AC 136 ms
57,420 KB
testcase_09 AC 139 ms
57,276 KB
testcase_10 AC 136 ms
57,720 KB
testcase_11 AC 138 ms
57,472 KB
testcase_12 AC 134 ms
57,392 KB
testcase_13 AC 134 ms
57,288 KB
testcase_14 AC 133 ms
57,136 KB
testcase_15 AC 133 ms
57,380 KB
testcase_16 AC 137 ms
57,240 KB
testcase_17 AC 136 ms
57,612 KB
testcase_18 AC 135 ms
57,520 KB
testcase_19 AC 133 ms
57,268 KB
testcase_20 AC 135 ms
57,356 KB
testcase_21 AC 136 ms
57,580 KB
testcase_22 AC 137 ms
55,052 KB
testcase_23 AC 141 ms
57,252 KB
testcase_24 AC 136 ms
57,012 KB
testcase_25 AC 144 ms
57,060 KB
testcase_26 AC 138 ms
57,072 KB
testcase_27 AC 136 ms
57,472 KB
testcase_28 AC 136 ms
57,028 KB
testcase_29 AC 136 ms
57,736 KB
testcase_30 AC 138 ms
57,564 KB
testcase_31 AC 137 ms
57,072 KB
testcase_32 AC 139 ms
55,280 KB
testcase_33 AC 136 ms
57,488 KB
testcase_34 AC 136 ms
57,540 KB
testcase_35 AC 137 ms
57,744 KB
testcase_36 AC 138 ms
57,272 KB
testcase_37 AC 137 ms
57,240 KB
testcase_38 AC 140 ms
57,044 KB
testcase_39 AC 136 ms
57,376 KB
testcase_40 AC 137 ms
57,592 KB
testcase_41 AC 139 ms
57,016 KB
testcase_42 AC 138 ms
57,064 KB
testcase_43 AC 135 ms
57,052 KB
testcase_44 AC 134 ms
57,496 KB
testcase_45 AC 136 ms
54,984 KB
testcase_46 AC 135 ms
55,040 KB
testcase_47 AC 133 ms
57,512 KB
testcase_48 AC 135 ms
57,532 KB
testcase_49 AC 137 ms
57,108 KB
testcase_50 AC 137 ms
57,500 KB
testcase_51 AC 142 ms
57,072 KB
testcase_52 AC 136 ms
57,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yuki_coder;

import java.util.Scanner;

public class No_327 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		sc.close();
		if(N==0){
			System.out.println("A");
		}else if(N < 26){
			System.out.println((char)('A' + N));
		}else if(N>=26){
			long[] ans = new long[12];
			int c = 0;
			long copy = N;
			while(copy > 26){
				copy /= 26;
				c++;
			}
			copy = N+1;
			for(int i = c; i >=0; i--){
				if(i!=0){
					ans[i] = copy % 26;
					if(ans[i] == 0){
						ans[i] = 26;
						copy -= 26;
					}
					if(i != 1){
					copy /= 26;
					}
				}else if(i==0){
					ans[i] = copy / 26;
					if(ans[i] == 0){
						ans[i] = 26;
					}
				}
			}
			for(int i = 0; i <= c; i++){
					ans[i] -= 1;
					System.out.print((char)(ans[i] + 'A'));
				}
			System.out.println();
			}
		}
	}
0