結果

問題 No.599 回文かい
ユーザー ikd
提出日時 2017-11-24 22:38:34
言語 D
(dmd 2.109.1)
結果
TLE  
実行時間 -
コード長 528 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 94,272 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-06-12 22:37:26
合計ジャッジ時間 6,033 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

  auto s=readln.chomp.to!(char[]);

  const long mod=1_000_000_000+7;
  long fun(char[] t){
    auto ret=1;
    foreach(i; 0..(t.length/2)){
      if(t[0..(i+1)]==t[($-i-1)..$]){
        (ret+=fun(t[(i+1)..($-i-1)]))%=mod; 
      }
    }
    return ret;
  }

  writeln(fun(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