結果

問題 No.327 アルファベット列
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-01-04 16:44:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 884 bytes
コンパイル時間 4,771 ms
コンパイル使用メモリ 77,844 KB
実行使用メモリ 55,840 KB
最終ジャッジ日時 2024-04-16 07:53:53
合計ジャッジ時間 11,945 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
53,772 KB
testcase_01 AC 134 ms
54,076 KB
testcase_02 AC 135 ms
54,104 KB
testcase_03 AC 132 ms
54,252 KB
testcase_04 AC 134 ms
53,952 KB
testcase_05 AC 133 ms
54,192 KB
testcase_06 AC 134 ms
54,248 KB
testcase_07 AC 136 ms
53,956 KB
testcase_08 AC 136 ms
53,764 KB
testcase_09 AC 134 ms
54,184 KB
testcase_10 AC 132 ms
54,196 KB
testcase_11 AC 133 ms
54,092 KB
testcase_12 AC 136 ms
54,192 KB
testcase_13 AC 133 ms
54,024 KB
testcase_14 AC 133 ms
53,944 KB
testcase_15 AC 132 ms
53,788 KB
testcase_16 AC 132 ms
54,104 KB
testcase_17 AC 131 ms
53,932 KB
testcase_18 AC 133 ms
53,912 KB
testcase_19 AC 135 ms
53,908 KB
testcase_20 AC 135 ms
54,044 KB
testcase_21 AC 135 ms
54,156 KB
testcase_22 AC 133 ms
54,092 KB
testcase_23 AC 133 ms
54,076 KB
testcase_24 AC 133 ms
53,972 KB
testcase_25 AC 133 ms
53,772 KB
testcase_26 AC 134 ms
54,412 KB
testcase_27 AC 134 ms
53,736 KB
testcase_28 AC 135 ms
53,876 KB
testcase_29 AC 133 ms
53,932 KB
testcase_30 AC 132 ms
53,896 KB
testcase_31 AC 132 ms
53,984 KB
testcase_32 AC 131 ms
53,704 KB
testcase_33 AC 137 ms
55,840 KB
testcase_34 AC 135 ms
53,840 KB
testcase_35 AC 134 ms
53,776 KB
testcase_36 AC 124 ms
52,928 KB
testcase_37 AC 135 ms
54,180 KB
testcase_38 AC 135 ms
53,896 KB
testcase_39 AC 135 ms
54,216 KB
testcase_40 AC 136 ms
54,104 KB
testcase_41 AC 136 ms
54,280 KB
testcase_42 AC 134 ms
53,948 KB
testcase_43 AC 135 ms
53,744 KB
testcase_44 AC 134 ms
54,052 KB
testcase_45 AC 133 ms
53,764 KB
testcase_46 AC 135 ms
53,696 KB
testcase_47 AC 134 ms
53,892 KB
testcase_48 AC 135 ms
53,920 KB
testcase_49 AC 136 ms
54,036 KB
testcase_50 AC 134 ms
53,944 KB
testcase_51 AC 134 ms
53,684 KB
testcase_52 AC 132 ms
53,752 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++;
			}
			if(N==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