第二十三篇英文翻译

2022/2/19 6:14:31

本文主要是介绍第二十三篇英文翻译,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

出处:https://acs.jxnu.edu.cn/problem/NOIOPJCH0405223

重点单词:

decomposition n.分解,腐烂,变质;

unimodal adj.单峰的;

UNIMODAL PALINDROMIC DECOMPOSITIONS

 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.

编写一个程序,计算整数的单峰回文分解数。

输入:

Input consists of a sequence of positive integers, one per line ending with a 0 (zero) indicating the end. 输入由一系列正整数组成,每行一个,以0(零)表示结束。

输出:

For each input value except the last, the output is a line containing the input value followed by a space, then the number of Unimodal Palindromic Decompositions of the input value. See the example on the next page. 对于除最后一个之外的每个输入值,输出是一行,包含输入值,后跟一个空格,然后是输入值的单峰回文分解数。请参见下一页的示例。

样例输入:

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

注释:

N < 250

Source: Greater New York 2002

这篇关于第二十三篇英文翻译的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程