結果

問題 No.327 アルファベット列
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-05 05:16:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 3,269 ms
コンパイル使用メモリ 73,100 KB
実行使用メモリ 58,324 KB
最終ジャッジ日時 2023-09-13 17:41:43
合計ジャッジ時間 11,328 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,880 KB
testcase_01 AC 123 ms
55,632 KB
testcase_02 AC 121 ms
56,036 KB
testcase_03 AC 121 ms
55,896 KB
testcase_04 AC 121 ms
55,888 KB
testcase_05 AC 124 ms
55,780 KB
testcase_06 AC 121 ms
55,728 KB
testcase_07 AC 123 ms
55,808 KB
testcase_08 AC 121 ms
55,548 KB
testcase_09 AC 119 ms
55,784 KB
testcase_10 AC 119 ms
55,816 KB
testcase_11 AC 120 ms
55,912 KB
testcase_12 AC 121 ms
55,644 KB
testcase_13 AC 123 ms
56,156 KB
testcase_14 AC 120 ms
55,704 KB
testcase_15 AC 120 ms
56,100 KB
testcase_16 AC 120 ms
56,080 KB
testcase_17 AC 120 ms
56,416 KB
testcase_18 AC 118 ms
56,096 KB
testcase_19 AC 121 ms
56,296 KB
testcase_20 AC 120 ms
56,056 KB
testcase_21 AC 122 ms
56,292 KB
testcase_22 AC 121 ms
55,988 KB
testcase_23 AC 122 ms
56,080 KB
testcase_24 AC 121 ms
56,164 KB
testcase_25 AC 122 ms
56,316 KB
testcase_26 AC 120 ms
55,928 KB
testcase_27 AC 123 ms
56,196 KB
testcase_28 AC 121 ms
56,004 KB
testcase_29 AC 119 ms
55,780 KB
testcase_30 AC 121 ms
56,200 KB
testcase_31 AC 120 ms
55,700 KB
testcase_32 AC 121 ms
55,536 KB
testcase_33 AC 120 ms
53,968 KB
testcase_34 AC 119 ms
55,792 KB
testcase_35 AC 121 ms
56,132 KB
testcase_36 AC 119 ms
56,052 KB
testcase_37 AC 120 ms
55,992 KB
testcase_38 AC 119 ms
55,472 KB
testcase_39 AC 119 ms
56,340 KB
testcase_40 AC 119 ms
53,688 KB
testcase_41 AC 120 ms
55,892 KB
testcase_42 AC 122 ms
58,324 KB
testcase_43 AC 118 ms
55,836 KB
testcase_44 AC 121 ms
56,100 KB
testcase_45 AC 119 ms
56,180 KB
testcase_46 AC 119 ms
56,240 KB
testcase_47 AC 120 ms
55,936 KB
testcase_48 AC 119 ms
55,708 KB
testcase_49 AC 121 ms
56,048 KB
testcase_50 AC 119 ms
56,132 KB
testcase_51 AC 121 ms
55,812 KB
testcase_52 AC 119 ms
55,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No327{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		if(n < 26){
			System.out.println((char)(65+n));
			return;
		}
		
		StringBuilder sb = new StringBuilder();
		int pow = 1;
		while(true){
			if(n >= (long)Math.pow(26, pow)){
				n -= Math.pow(26, pow);
				pow++;
			}else{
				pow--;
				break;
			}
		}
		// System.out.println(pow);

		for(int p = pow; p >= 0; p--){
			long div = n/(long)Math.pow(26, p);
			sb.append((char)(65+div));
			n -= div*(long)Math.pow(26, p);
		}

		System.out.println(sb);
	}
}
0