結果

問題 No.600 かい文回
ユーザー ikdikd
提出日時 2017-11-26 12:07:21
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 83,516 KB
実行使用メモリ 7,708 KB
最終ジャッジ日時 2023-09-03 17:05:16
合計ジャッジ時間 5,267 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.array;

  int n; rd(n);
  
  char[] s=['a'];
  int k=1;
  while(k<n){
    if(k*2<=n){
      s=s[0]~s~s[$-1];
      k*=2;
    }else{
      for(char c='a'; c<='z'; c++){
        if(c!=s[0]){s=c~s~c; break;}
      }
      k+=1;
    }
  }

  writeln(s);
}


void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
0