結果
問題 | No.600 かい文回 |
ユーザー | 夕叢霧香(ゆうむらきりか) |
提出日時 | 2017-11-24 22:51:17 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 127 ms / 2,000 ms |
コード長 | 1,158 bytes |
コンパイル時間 | 2,113 ms |
コンパイル使用メモリ | 80,360 KB |
実行使用メモリ | 41,808 KB |
最終ジャッジ日時 | 2024-05-05 11:14:53 |
合計ジャッジ時間 | 5,593 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 117 ms
41,184 KB |
testcase_01 | AC | 111 ms
41,672 KB |
testcase_02 | AC | 102 ms
40,392 KB |
testcase_03 | AC | 118 ms
41,808 KB |
testcase_04 | AC | 114 ms
41,544 KB |
testcase_05 | AC | 115 ms
40,944 KB |
testcase_06 | AC | 109 ms
40,964 KB |
testcase_07 | AC | 105 ms
40,528 KB |
testcase_08 | AC | 113 ms
41,400 KB |
testcase_09 | AC | 111 ms
41,344 KB |
testcase_10 | AC | 115 ms
41,480 KB |
testcase_11 | AC | 109 ms
40,276 KB |
testcase_12 | AC | 127 ms
41,348 KB |
testcase_13 | AC | 121 ms
41,456 KB |
testcase_14 | AC | 103 ms
40,036 KB |
testcase_15 | AC | 114 ms
41,320 KB |
testcase_16 | AC | 116 ms
41,432 KB |
testcase_17 | AC | 103 ms
40,028 KB |
testcase_18 | AC | 106 ms
40,420 KB |
testcase_19 | AC | 115 ms
41,300 KB |
testcase_20 | AC | 116 ms
41,564 KB |
ソースコード
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<16;++i){ d[i]=Character.toString((char)(97+i)); } for(int i=16;i<32;++i){ int x=(i-16)/4; int y=(i-16)%4; char[] k={(char)(97+16+x),(char)(97+20+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); } }