結果

問題 No.600 かい文回
ユーザー 夕叢霧香(ゆうむらきりか)夕叢霧香(ゆうむらきりか)
提出日時 2017-11-24 22:48:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,158 bytes
コンパイル時間 3,087 ms
コンパイル使用メモリ 76,316 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2023-08-18 05:00:37
合計ジャッジ時間 7,028 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
56,180 KB
testcase_01 AC 127 ms
55,548 KB
testcase_02 AC 132 ms
55,816 KB
testcase_03 AC 136 ms
56,032 KB
testcase_04 AC 129 ms
56,108 KB
testcase_05 AC 128 ms
56,076 KB
testcase_06 AC 134 ms
55,708 KB
testcase_07 AC 129 ms
55,848 KB
testcase_08 AC 140 ms
55,800 KB
testcase_09 AC 137 ms
56,112 KB
testcase_10 AC 137 ms
55,800 KB
testcase_11 AC 134 ms
55,860 KB
testcase_12 AC 137 ms
56,160 KB
testcase_13 AC 129 ms
55,992 KB
testcase_14 AC 137 ms
55,972 KB
testcase_15 AC 134 ms
55,748 KB
testcase_16 AC 130 ms
55,864 KB
testcase_17 WA -
testcase_18 AC 131 ms
55,740 KB
testcase_19 AC 136 ms
55,816 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long n=scan.nextLong();
        String[] d=new String[32];
        int p=1;
        for(int i=0;i<20;++i){
            d[i]=Character.toString((char)(97+i));
        }
        for(int i=20;i<32;++i){
            int x=(i-20)/4;
            int y=(i-20)%4;
            char[] k={(char)(97+20+x),(char)(97+24+y)};
            d[i]=new String(k);
        }
        String c="a";
        StringBuilder sb=new StringBuilder();
        StringBuilder rev=new StringBuilder();
        int h=-1;
        for(int i=30;i>=0;--i){
            if(1L<<i>n){continue;}
            h=i;break;
        }
        for(int i=h-1;i>=0;--i){
            //2bai
            sb.append(c);
            rev.append(new StringBuilder(c).reverse());
            //+1
            if((n&1<<i)!=0){
                c=d[p++];
                sb.append(c);
                rev.append(new StringBuilder(c).reverse());
            }
        }
        String r=rev.reverse().toString()+sb;
        if(r.length()==0)r="s";
        System.out.println(r);
    }
}
0