问题 1119. -- Combining Orz Pandas

1119: Combining Orz Pandas

时间限制:1000 ms 内存限制:128 MB
提交:28 解决:16
[ 提交][ 状态][ 讨论版]

题目描述

Orz pandas are very lovely and we send them in QQ to show our respect to someone very diaoable, for example God Wan. Master Nuo loves to create new Orz panda emotion by combining some small Orz panda emotions. For example, by combining four Orz pandas A, Master Nuo can get a new emotion X. And by combining one Orz panda B and some Orz panda A's, he can get a new emotion Y.

A

B

X

Y

Master Nuo has N small Orz panda emotions, with period T1, T2, …, Tn. Now he wants to combine exactly K ones of them, in order to create one large Orz panda emotion. To keep the GIF file small, he wants to minimize T, the period of the large Orz panda emotion.

However, if the minimal T is larger than 1000, the emotion will be too large to be sent. So Master Nuo would simply type “Orz” in QQ, instead of sending an emotion.

输入

There are multiple test cases, please process to EOF. For each test case:

The first line contains two integers N and K.
The second line contains N space separated integersT1, T2, …, Tn.

For all test cases, 1KN50, 1≤Ti≤1000

输出

For each test case, output one line. If minimal T is not larger than 1000, output it. Otherwise output “Orz”.

样例输入

5 4 10 10 10 10 100 17 14 1 3 10 10 10 10 10 10 10 10 10 10 10 10 10 11 7 3 2 1000 1000 999 3 2 1000 999 998

样例输出

10 10 1000 Orz

提示

For the first sample, the answer is X.
For the second sample, the answer is Y.
For the third sample, Master Nuo have to choose the first and the second Orz panda.
For the fourth sample, the minimal T is 499000, larger than 1000.

来源

[ 提交][ 状态][ 讨论版]
Baidu
map