编程介的小学生 2019-06-29 22:38 采纳率: 20.5%
浏览 192

计算水渠的蓄水量的问题,怎么用C语言的代码的程序的编写的步骤的过程来实现的呢

Problem Description
Tclsm is a beiju guy, so is the beiju he has just bought. The shape he bought beiju (or cup) is not a regular cylinder, but a container with zigzag wall, as the figure shows. Tclsm wanted to know how much water the beiju can hold. As a sophisticated programmer, you are asked to help him.
Placing the beiju on the floor without constraint and pour water into it slowly, the moment water streams out from the beiju, or the beiju falls down,the volume of the water reaches the maximum.
To simplify the problem, you can assume the beiju in 2-dimensional case. There are two walls of the beiju – the left one and the right one. The bottom of the beiju is entirely on the floor.

Input
The first line of the input is T, the number of test cases.
Each case has thee lines.
First line has two integers – m n, 1 < m, n < 100. the number of break point of the left wall and the right wall.
Second line has 2m integers, p0x p0y p1x p1y……pm-1x pm-1y, describing the coordinate of the break points in the left wall, from the bottom to top.
Third line has 2n integers, q0x q0y q1x q1y……qn-1x qn-1y, describing the coordinate of the break points in the right wall, from the bottom to top.
You can assume:

p0y < p1y <……< pm-1y,q0y < q1y <……< qm-1y,p0y = q0y, p0x < q0x

The two walls do not touch or intersect.

The two walls have zero thickness.

All the numbers in the input are in the range [0, 1000].

Output
For each case out put one line containing the maximum height of water the beiju can hold, rounding to the thousands.

Sample Input
2
3 3
0 0 1 1 2 2
1 0 2 1 3 2
2 2
0 0 0 2
1 0 1 2

Sample Output
1.000
2.000

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于#flink#的问题:关于docker部署flink集成hadoop的yarn,请教个问题flink启动yarn-session.sh连不上hadoop
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题