编程介的小学生 2019-06-10 16:59 采纳率: 20.5%
浏览 95

分段路径求和的计算问题的数据结构怎么用C语言的程序设计思想编写出来的程序代码来实现的

Problem Description
In the dark path, the single figure is walking difficultly in the listless rainfall. No one knows his real destination.

‘Young, have you ever tasted the loneliness walking in dark path; have you ever run about madly just to avoid the pain in the deep heart?'
After BiYao's death, XiaoFan changed to GuiLi .Running in such darkness, leaving the rain wet out his clothes, leaving the darkness cover up his eyes, he will never regret!

Now, we separate the path into n parts with the same length (1<=N<=1000).Every part has its value Ai (-1000<=Ai<=1000). If Xiaofan walks through the ith part of the path, he will get the hurt Ai. His trump ShaoHuoGun will give him S chances to fly (1<=S<=100). Every chance can help him get through one part of the path without any hurt. But there’s a limit: The length of his fly Si should be longer than La and shorter than Lb (1<=La<=Si<=Lb<=n).
Your job is to find the best way for XiaoFan to have the least hurt.
Hit: Two different fly paths can't cover each other, and times of fly can be fewer than the given times S.

Input
There are several test cases. The first line is an integer N, then the second line have three integers Lb, La, S, then followed N integers A1.A2…An.The test end by n = 0.

Output
The value of least hurt.

Sample Input
10
3 2 3
3 1 -5 -9 2 -1 1 -7 9 10

10
4 3 4
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1

0

Sample Output
-21
-10

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Qt下使用tcp获取数据的详细操作
    • ¥15 idea右下角设置编码是灰色的
    • ¥15 全志H618ROM新增分区
    • ¥20 jupyter保存图像功能的实现
    • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
    • ¥15 NAO机器人的录音程序保存问题
    • ¥15 C#读写EXCEL文件,不同编译
    • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
    • ¥15 扩散模型sd.webui使用时报错“Nonetype”
    • ¥15 stm32流水灯+呼吸灯+外部中断按键