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

建议使用的浏览器:

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

1244:Slots of Fun

题目描述
The International Betting Machine company has just issued a new type of slot machine. The machine display consists of a set of identical circles placed in a triangular shape. An example with four rows is shown below. When the player pulls the lever, the machine places a random letter in the center of each circle. The machine pays off whenever any set of identical letters form the vertices of an equilateral triangle. In the example below, the letters 'a' and 'c' satisfy this condition.

In order to prevent too many payoffs, the electronics in the machine ensures that no more than 3 of any letter will appear in any display configuration.
IBM is manufacturing several models of this machine, with varying number of rows in the display, and they are having trouble writing code to identify winning configurations. Your job is to write that code.
输入解释
Input will consist of multiple problem instances. Each instance will start with an integer n indicating the number of rows in the display. The next line will contain n(n + 1)/2 letters of the alphabet (all lowercase) which are to be stored in the display row-wise, starting from the top. For example, the display above would be specified as
4
abccddadca
The value of n will be between 1 and 12, inclusive. A line with a single 0 will terminate input.
输出解释
For each problem instance, output all letters which form equilateral triangles on a single line, in alphabetical order. If no such letters exist, output "LOOOOOOOOSER!".
输入样例
4
abccddadca
6
azdefccrhijrrmznzocpq
2
abc
0
输出样例
ac
crz
LOOOOOOOOSER!

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

源链接: POJ-1244

最后修改于 2020-10-29T05:58:44+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000