結果

問題 No.327 アルファベット列
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-01-04 16:35:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 857 bytes
コンパイル時間 3,713 ms
コンパイル使用メモリ 78,208 KB
実行使用メモリ 57,768 KB
最終ジャッジ日時 2023-10-19 15:04:09
合計ジャッジ時間 13,137 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
57,440 KB
testcase_01 AC 138 ms
57,516 KB
testcase_02 AC 140 ms
57,696 KB
testcase_03 AC 136 ms
57,500 KB
testcase_04 WA -
testcase_05 AC 138 ms
57,560 KB
testcase_06 AC 139 ms
57,420 KB
testcase_07 AC 140 ms
55,420 KB
testcase_08 AC 138 ms
57,544 KB
testcase_09 AC 137 ms
57,580 KB
testcase_10 AC 140 ms
57,480 KB
testcase_11 AC 139 ms
57,680 KB
testcase_12 AC 137 ms
57,448 KB
testcase_13 AC 139 ms
57,436 KB
testcase_14 AC 133 ms
57,456 KB
testcase_15 AC 136 ms
57,468 KB
testcase_16 AC 134 ms
57,204 KB
testcase_17 AC 133 ms
57,564 KB
testcase_18 AC 135 ms
57,456 KB
testcase_19 AC 134 ms
57,272 KB
testcase_20 AC 134 ms
57,396 KB
testcase_21 AC 139 ms
57,496 KB
testcase_22 AC 136 ms
57,472 KB
testcase_23 AC 135 ms
57,596 KB
testcase_24 AC 137 ms
57,476 KB
testcase_25 AC 137 ms
57,516 KB
testcase_26 AC 134 ms
57,468 KB
testcase_27 AC 135 ms
57,220 KB
testcase_28 AC 135 ms
57,268 KB
testcase_29 AC 136 ms
57,604 KB
testcase_30 WA -
testcase_31 AC 135 ms
57,708 KB
testcase_32 AC 137 ms
57,444 KB
testcase_33 AC 137 ms
57,256 KB
testcase_34 AC 136 ms
57,696 KB
testcase_35 AC 136 ms
57,512 KB
testcase_36 AC 137 ms
57,256 KB
testcase_37 AC 137 ms
57,492 KB
testcase_38 AC 137 ms
57,472 KB
testcase_39 AC 136 ms
57,504 KB
testcase_40 AC 136 ms
57,576 KB
testcase_41 WA -
testcase_42 AC 134 ms
57,192 KB
testcase_43 AC 134 ms
57,464 KB
testcase_44 AC 134 ms
57,476 KB
testcase_45 AC 137 ms
57,312 KB
testcase_46 AC 134 ms
57,472 KB
testcase_47 AC 138 ms
57,704 KB
testcase_48 AC 138 ms
57,188 KB
testcase_49 AC 138 ms
57,424 KB
testcase_50 AC 136 ms
57,724 KB
testcase_51 AC 138 ms
57,420 KB
testcase_52 AC 136 ms
57,488 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