yukicoder-599
从 Trac 迁移的文章
这是从旧校内 Wiki 迁移的文章,可能存在一些样式问题,您可以向 memset0 反馈。
原文章内容如下:
{{{
#!html
<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});</script>
<script type="text/javascript" async src="http://10.71.10.90/sfiction/tool/MathJax/MathJax-master/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<style>
.input, pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
</style>
}}}
== [https://yukicoder.me/problems/no/599 No.599 回文かい] ==
=== Description ===
{{{
#!html
<p>对于一个字符串$S$,定义它的回文分解为$T=[T_1,T_2,\dots,T_k]$,其中$S=T_1+T_2+\dots+T_k$,$|T_i| \ge 1$, 并且对于每个$i$ ($1 \le i \le k$)都有$T_i=T_{k-i+1}$。</p>
<p>给定一个字符串$S$,求回文分解的方案数$\bmod (10^9+7)$。</p>
}}}
=== Input ===
{{{
#!html
<p class="input">$S$</p>
<p>
$1 \leq |S| \leq 10^{4}$,$S$仅由英文小写字符构成。
</p>
}}}
=== Output ===
{{{
#!html
输出回文分解方案数$\bmod (10^9+7)$。
}}}
=== Sample ===
==== Sample 1 ====
输入
{{{
#!html
<pre>
abc
</pre>
}}}
输出
{{{
#!html
<pre>
1
</pre>
}}}
==== Sample 2 ====
输入
{{{
#!html
<pre>
suidousui
</pre>
}}}
输出
{{{
#!html
<pre>
2
</pre>
}}}
==== Sample 3 ====
输入
{{{
#!html
<pre>
kaibunkaibunkai
</pre>
}}}
输出
{{{
#!html
<pre>
3
</pre>
}}}
==== Sample 4 ====
输入
{{{
#!html
<pre>
aaaaa
</pre>
}}}
输出
{{{
#!html
<pre>
4
</pre>
}}}
No.599 回文かい
Description
对于一个字符串$S$,定义它的回文分解为$T=[T_1,T_2,\dots,T_k]$,其中$S=T_1+T_2+\dots+T_k$,$|T_i| \ge 1$, 并且对于每个$i$ ($1 \le i \le k$)都有$T_i=T_{k-i+1}$。
给定一个字符串$S$,求回文分解的方案数$\bmod (10^9+7)$。
Input
$S$
$1 \leq |S| \leq 10^{4}$,$S$仅由英文小写字符构成。
Output
输出回文分解方案数$\bmod (10^9+7)$。Sample
Sample 1
输入
abc
输出
1
Sample 2
输入
suidousui
输出
2
Sample 3
输入
kaibunkaibunkai
输出
3
Sample 4
输入
aaaaa
输出
4