結果

問題 No.600 かい文回
ユーザー ikdikd
提出日時 2017-11-26 12:27:49
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 581 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 83,580 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 17:05:23
合計ジャッジ時間 3,758 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

  int n; rd(n);
  
  char[] fun(int m){
    if(m==1) return ['a'];
    char[] ret;
    if(m&1){
      ret=fun(m-1);
      for(char c='a'; c<='z'; c++){
        if(c!=ret[0]){ret=c~ret~c; break;}
      }
    }else{
      ret=fun(m/2);
      ret=ret[0]~ret~ret[$-1];
    }
    return ret;
  }

  writeln(fun(n));
}


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