結果

問題 No.599 回文かい
コンテスト
ユーザー _____Yuto___
提出日時 2017-11-25 00:35:49
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 374 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 581 ms
コンパイル使用メモリ 72,716 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2026-05-21 15:14:20
合計ジャッジ時間 8,107 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
using namespace std;

#define MOD (int)(1e9 + 7)

int solve(string s)
{
  int ret = 1, n = s.length();
  for(int i = 1; i <= n / 2; i++){
    if(s.substr(0, i) == s.substr(n - i, i)){
      ret += solve(s.substr(i, n - 2 * i));
    }
  }
  return ret;
}

int main()
{
  string s;
  cin >> s;

  cout << solve(s) << endl;

  return 0;
}
0