编程介的小学生 2019-06-14 17:28 采纳率: 20.5%
浏览 109

排序后计算的位置的问题,怎么使用C语言的程序的编写设计的代码的方式和过程来解决的呢

Problem Description
Xiao Ming is travelling, and today he came to the West Lake, to see people playing a game, this game is like this, lake placed n-box, from 1 to n label. These boxes are floating in the water, there are some gold inside each box. Then participants from coast to jump the other side, each box have its’s height, you can only jump from lower height to higher height, and from a small label to a big label, you can skip some of the middle of the box. Suppose the minimum height is this side, the other side has the maximum height. Xiao Ming would like to jump how to get the most gold? He now needs your help.

Input
There are multiple test cases. Each test case contains one integer N , representing the number of boxes . The following N lines each line contains two integers hi and gi , indicate the height and the number of gold of the ith box.
1 < = N < 100 001
0 < hi < 100 000 001
0 < gi < = 10000

Output
For each test case you should output a single line, containing the number of maximum gold XiaoMing can get.

Sample Input
4
1 1
2 2
2 3
5 1

1
1 10000

Sample Output
5
10000

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器