1000ms 65536K
A sequence of positive integers is Palindromic if it reads the same forward and backward. For example:
一系列由正整数组成的序列如果不管是从前往后读还是从后往前读都相同那么其是回文的。举例如下:
23 11 15 1 37 37 1 15 11 23
1 1 2 3 4 7 7 10 7 7 4 3 2 1 1
A Palindromic sequence is Unimodal Palindromic if the values do not decrease up to the middle value and then (since the sequence is palindromic) do not increase from the middle to the end For example, the first example sequence above is NOT Unimodal Palindromic while the second example is.
如果从开始到中间值没有减少,且(因为序列是回文序列)从中间到结尾值没有增加,那么回文序列就是单峰回文序列。例如,上面的第一个示例序列不是单峰回文序列,而第二个示例是单峰回文序列。
A Unimodal Palindromic sequence is a Unimodal Palindromic Decomposition of an integer N, if the sum of the integers in the sequence is N. For example, all of the Unimodal Palindromic Decompositions of the first few integers are given below:
单峰回文序列是整数N的单峰回文分解,如果序列中的整数和为N。例如,前几个整数的所有单峰回文分解如下所示:
1: (1)
2: (2), (1 1)
3: (3), (1 1 1)
4: (4), (1 2 1), (2 2), (1 1 1 1)
5: (5), (1 3 1), (1 1 1 1 1)
6: (6), (1 4 1), (2 2 2), (1 1 2 1 1), (3 3),
(1 2 2 1), ( 1 1 1 1 1 1)
7: (7), (1 5 1), (2 3 2), (1 1 3 1 1), (1 1 1 1 1 1 1)
8: (8), (1 6 1), (2 4 2), (1 1 4 1 1), (1 2 2 2 1),
(1 1 1 2 1 1 1), ( 4 4), (1 3 3 1), (2 2 2 2),
(1 1 2 2 1 1), (1 1 1 1 1 1 1 1)
Write a program, which computes the number of Unimodal Palindromic Decompositions of an integer.
编写一个程序,计算整数的单峰回文分解数。
2 3 4 5 6 7 8 10 23 24 131 213 92 0
2 2 3 2 4 4 5 3 6 7 7 5 8 11 10 17 23 104 24 199 131 5010688 213 1055852590 92 331143