当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2558:Genetic Code

Special Judge 特殊评判
题目描述
The connections between mathematics and biology are complicated. Most of the time they do not run along nice-looking links that merrily join at first glance, but they are abstract and not always easily established.

Lake Vostok - about 14000 square kilometers large, up to 650 meters deep, and covered by 3743 meters of ice - was recently discovered on the Antarctic continent. The lake remained under conditions of high pressure and no sunlight for several millions of years. It is believed that ordinary life has evolved to a more efficient form using a genetic code composed of only three bases (the current state of ignorance proclaims the four bases adenine, cytosine, guanine, and thymine). Until reasonable names are found, the three bases will be abbreviated as N, O, and P.

Moreover, the genome is single-stranded and directed, i.e., we may see it as a sequence over the alphabet {N,O,P}. Unless risking instability, it is necessary that the genome is a Thue-sequence, due to the Norwegian mathematician A. Thue (1863-1922). Define a subsegment of a sequence to be a connected subsequence, and call two subsegments adjacent if one follows immediately after the other in the sequence. A Thue-sequence is a sequence where no adjacent subsegments are equal. For example, NOPNO is and NOPNPNO is not a Thue-sequence, so that the first may be a genome whereas the second may not.

To be able to simulate experiments with the new genomes, you are asked to generate genomes of certain lengths.
输入解释
The input contains several test cases. Each test case consists of an integer n. You may assume that 1<=n<=5000. The last test case is followed by a zero.
输出解释
For each test case specified by n output on a single line any genome of length n. If no genome of length n exists, output a blank line instead.
输入样例
1
2
10
20
0
输出样例
N
NO
NONPNOPNPO
NONPNOPNPONOPNONPNOP

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Ulm Local 2003

源链接: POJ-2558

最后修改于 2020-10-29T06:35:49+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000 65536