The Largest/Smallest Box..
时间: 1ms 内存:64M
描述:
The following figure shows a rectangular card of width W, length L, and thickness 0. Four x x x squares are cut from the four corners of the card shown by the dotted lines. The card is then folded along the dashed lines to make a box without a cover.
Given the width and height of the box, find the values of x for which the box has maximum and minimum volume.
输入:
The input file contains several lines of input. Each line contains two positive floating point numbers L ( 0 < L < 10, 000) and W ( 0 < W < 10, 000), which indicate the length and width of the card, respectively.
输出:
For each line of input, give one line of output containing two or more floating point numbers separated by a single space. Each floating point number should contain three digits after the decimal point. The first number indicates the value which maximizes the volume of the box, while the subsequent values (sorted in ascending order) indicate the cut values which minimize the volume of the box.
示例输入:
1 1
2 2
3 3
示例输出:
0.167 0.000 0.500
0.333 0.000 1.000
0.500 0.000 1.500
提示:
参考答案:
文章评论