結果

問題 No.327 アルファベット列
ユーザー rf141rf141
提出日時 2015-12-22 22:12:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 2,097 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 41,704 KB
最終ジャッジ日時 2024-04-16 07:34:11
合計ジャッジ時間 10,368 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
40,876 KB
testcase_01 AC 130 ms
41,248 KB
testcase_02 AC 130 ms
40,868 KB
testcase_03 AC 129 ms
41,252 KB
testcase_04 AC 131 ms
41,452 KB
testcase_05 AC 130 ms
41,080 KB
testcase_06 AC 128 ms
40,796 KB
testcase_07 AC 130 ms
40,876 KB
testcase_08 AC 132 ms
41,704 KB
testcase_09 AC 130 ms
41,132 KB
testcase_10 AC 129 ms
41,084 KB
testcase_11 AC 116 ms
39,864 KB
testcase_12 AC 134 ms
41,164 KB
testcase_13 AC 133 ms
41,428 KB
testcase_14 AC 128 ms
41,056 KB
testcase_15 AC 129 ms
41,364 KB
testcase_16 AC 133 ms
41,216 KB
testcase_17 AC 131 ms
41,340 KB
testcase_18 AC 130 ms
40,868 KB
testcase_19 AC 131 ms
40,824 KB
testcase_20 AC 130 ms
41,016 KB
testcase_21 AC 130 ms
41,216 KB
testcase_22 AC 133 ms
41,272 KB
testcase_23 AC 132 ms
41,284 KB
testcase_24 AC 133 ms
41,216 KB
testcase_25 AC 122 ms
40,088 KB
testcase_26 AC 129 ms
41,412 KB
testcase_27 AC 134 ms
41,064 KB
testcase_28 AC 117 ms
40,172 KB
testcase_29 AC 131 ms
41,216 KB
testcase_30 AC 131 ms
41,288 KB
testcase_31 AC 117 ms
39,964 KB
testcase_32 AC 118 ms
40,208 KB
testcase_33 AC 118 ms
40,064 KB
testcase_34 AC 129 ms
41,276 KB
testcase_35 AC 128 ms
41,400 KB
testcase_36 AC 129 ms
41,576 KB
testcase_37 AC 129 ms
41,272 KB
testcase_38 AC 132 ms
41,576 KB
testcase_39 AC 131 ms
41,336 KB
testcase_40 AC 132 ms
41,220 KB
testcase_41 AC 130 ms
41,216 KB
testcase_42 AC 132 ms
41,544 KB
testcase_43 AC 128 ms
41,428 KB
testcase_44 AC 116 ms
39,768 KB
testcase_45 AC 130 ms
41,180 KB
testcase_46 AC 133 ms
41,428 KB
testcase_47 AC 132 ms
41,476 KB
testcase_48 AC 131 ms
41,024 KB
testcase_49 AC 131 ms
41,296 KB
testcase_50 AC 129 ms
41,456 KB
testcase_51 AC 130 ms
41,216 KB
testcase_52 AC 132 ms
41,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		if(n == 0){
			System.out.println('A');
		}else if(0 < n && n < 26){
			System.out.println((char)(n+'A'));
		}else{
			int[] res = new int[15];
			int count = 0;
			n++;
			while(0 < n){
				res[count] += n%26;
				if(res[count] == 0){
					res[count] = 26;
					n-=26;
				}
				count++;
				n/=26;
			}

			for(int i = count -1; 0 <= i; i--){
				System.out.print((char)(res[i]-1+'A'));
			}
			System.out.println();
		}

	}
}
0