結果

問題 No.327 アルファベット列
ユーザー jp_stejp_ste
提出日時 2016-05-13 16:04:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 77,100 KB
実行使用メモリ 56,916 KB
最終ジャッジ日時 2024-04-16 08:22:02
合計ジャッジ時間 12,951 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 170 ms
55,120 KB
testcase_01 AC 169 ms
55,416 KB
testcase_02 AC 167 ms
55,100 KB
testcase_03 AC 170 ms
54,564 KB
testcase_04 AC 171 ms
55,248 KB
testcase_05 AC 171 ms
56,916 KB
testcase_06 AC 172 ms
54,840 KB
testcase_07 AC 169 ms
55,092 KB
testcase_08 AC 167 ms
55,068 KB
testcase_09 AC 167 ms
55,132 KB
testcase_10 AC 169 ms
54,884 KB
testcase_11 AC 167 ms
54,704 KB
testcase_12 AC 169 ms
54,764 KB
testcase_13 AC 169 ms
54,976 KB
testcase_14 AC 168 ms
55,232 KB
testcase_15 AC 167 ms
54,804 KB
testcase_16 AC 171 ms
55,008 KB
testcase_17 AC 166 ms
54,820 KB
testcase_18 AC 169 ms
55,120 KB
testcase_19 AC 167 ms
54,836 KB
testcase_20 AC 169 ms
55,104 KB
testcase_21 AC 168 ms
55,416 KB
testcase_22 AC 168 ms
55,012 KB
testcase_23 AC 168 ms
54,868 KB
testcase_24 AC 168 ms
55,288 KB
testcase_25 AC 169 ms
54,684 KB
testcase_26 AC 165 ms
54,816 KB
testcase_27 AC 172 ms
54,940 KB
testcase_28 AC 168 ms
54,924 KB
testcase_29 AC 170 ms
54,852 KB
testcase_30 AC 169 ms
54,700 KB
testcase_31 AC 169 ms
54,780 KB
testcase_32 AC 168 ms
54,780 KB
testcase_33 AC 166 ms
54,892 KB
testcase_34 AC 166 ms
54,904 KB
testcase_35 AC 165 ms
54,948 KB
testcase_36 AC 164 ms
54,872 KB
testcase_37 AC 168 ms
54,684 KB
testcase_38 AC 167 ms
55,016 KB
testcase_39 AC 170 ms
54,744 KB
testcase_40 AC 167 ms
55,056 KB
testcase_41 AC 168 ms
54,964 KB
testcase_42 AC 169 ms
55,204 KB
testcase_43 AC 169 ms
55,152 KB
testcase_44 AC 167 ms
55,044 KB
testcase_45 AC 169 ms
54,780 KB
testcase_46 AC 169 ms
54,892 KB
testcase_47 AC 167 ms
55,144 KB
testcase_48 AC 169 ms
54,928 KB
testcase_49 AC 170 ms
55,020 KB
testcase_50 AC 169 ms
55,260 KB
testcase_51 AC 167 ms
54,812 KB
testcase_52 AC 168 ms
54,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            long n = Long.parseLong(scan.next());
            String ans = "";
            boolean first = true;
            
            while(true) {
                long rem = n % 26;
                if(!first) {
                    if(rem == 0) { 
                        rem = 25;
                        n--;
                    } else {
                        rem--;
                    }
                } else {
                    first = false;
                }
                ans = (char)(rem+'A') + ans;
                long div = n / 26;
                n = div;
                if(n==0) break;   
            }
            System.out.println(ans);
        }
    }
}
0