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

建议使用的浏览器:

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

2519:Cutting Necklace

题目描述
Today is Valentine's Day. Gnaf Ynot is going to present a beautiful necklace to his girl friend Mxxjx. He has bought a necklace of pearls some time ago. The necklace consists of many sheeny pearls and is very pretty. However, the necklace is too long for his girl friend. So Gnaf Ynot has to cut a slice from the necklace so that he can get a shorter one. He wants that the cut slice of necklace can be as evenly bright as possible, i.e. the average brightness of the slice should be maximized. Gnaf Ynot requests your help.

The necklace is in the form of a ring of pearls. Each pearl has a brightness. Your task is to cut a substring of pearls from the ring, so that the substring has the largest average brightness of pearls. The substring you cut should not be too long or too short as well. To help Gnaf Ynot making Mxxjx happy, please try your best to solve this problem!
输入解释
Input contains multiple test cases. Each test case starts a line containing three numbers N, L, U (1 <= L <= U <= N <= 1000000), which are the number of pearls of the necklace, the permitted shortest length and the longest length of the cut slice. Then the following line gives the brightness of each pearl (the value of brightness are integers and in the range of [-1000, 1000]).
输出解释
For each test case print the largest average brightness of the slice you cut from the necklace in one line. The result should be represented using fraction form such as A/B (here A and B are integers, B > 0 and (A, B) = 1).
输入样例
4 2 3
4 -1 3 1
4 2 2
4 -1 3 1
输出样例
8/3
5/2

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

源链接: POJ-2519

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

共提交 0

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