编程介的小学生 2016-12-19 11:21 采纳率: 20.5%
浏览 861
已采纳

Cutting Necklace

Description

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

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]).
Output

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).
Sample Input

4 2 3
4 -1 3 1
4 2 2
4 -1 3 1
Sample Output

8/3
5/2

  • 写回答

1条回答 默认 最新

  • devmiao 2016-12-19 16:43
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度