結果

問題 No.327 アルファベット列
ユーザー jp_stejp_ste
提出日時 2016-05-13 16:04:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 2,798 ms
コンパイル使用メモリ 85,704 KB
実行使用メモリ 42,540 KB
最終ジャッジ日時 2024-10-06 23:36:10
合計ジャッジ時間 12,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
42,236 KB
testcase_01 AC 157 ms
42,220 KB
testcase_02 AC 166 ms
42,180 KB
testcase_03 AC 159 ms
42,256 KB
testcase_04 AC 157 ms
42,148 KB
testcase_05 AC 164 ms
42,320 KB
testcase_06 AC 160 ms
42,176 KB
testcase_07 AC 159 ms
42,192 KB
testcase_08 AC 158 ms
42,168 KB
testcase_09 AC 157 ms
42,236 KB
testcase_10 AC 156 ms
42,236 KB
testcase_11 AC 138 ms
41,644 KB
testcase_12 AC 156 ms
42,276 KB
testcase_13 AC 158 ms
42,304 KB
testcase_14 AC 161 ms
42,340 KB
testcase_15 AC 157 ms
42,320 KB
testcase_16 AC 159 ms
42,392 KB
testcase_17 AC 156 ms
42,304 KB
testcase_18 AC 156 ms
42,168 KB
testcase_19 AC 157 ms
41,912 KB
testcase_20 AC 159 ms
42,492 KB
testcase_21 AC 155 ms
42,488 KB
testcase_22 AC 155 ms
42,244 KB
testcase_23 AC 143 ms
41,880 KB
testcase_24 AC 157 ms
42,360 KB
testcase_25 AC 156 ms
42,148 KB
testcase_26 AC 162 ms
42,392 KB
testcase_27 AC 160 ms
42,392 KB
testcase_28 AC 143 ms
41,808 KB
testcase_29 AC 162 ms
42,188 KB
testcase_30 AC 160 ms
42,184 KB
testcase_31 AC 160 ms
42,392 KB
testcase_32 AC 158 ms
42,352 KB
testcase_33 AC 163 ms
42,052 KB
testcase_34 AC 158 ms
42,236 KB
testcase_35 AC 156 ms
42,052 KB
testcase_36 AC 156 ms
42,300 KB
testcase_37 AC 153 ms
42,076 KB
testcase_38 AC 155 ms
42,320 KB
testcase_39 AC 159 ms
42,412 KB
testcase_40 AC 156 ms
42,076 KB
testcase_41 AC 159 ms
42,360 KB
testcase_42 AC 166 ms
42,056 KB
testcase_43 AC 153 ms
42,212 KB
testcase_44 AC 156 ms
42,284 KB
testcase_45 AC 166 ms
42,540 KB
testcase_46 AC 160 ms
42,412 KB
testcase_47 AC 158 ms
42,344 KB
testcase_48 AC 157 ms
42,084 KB
testcase_49 AC 157 ms
42,148 KB
testcase_50 AC 158 ms
42,292 KB
testcase_51 AC 155 ms
42,152 KB
testcase_52 AC 157 ms
42,448 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