编程介的小学生 2019-09-21 22:38 采纳率: 20.5%
浏览 116

Bob and Alice’s Meet 的问题

Problem Description
Bob and Alice are quite closely friends. They are both intersted on Researching ciper. As everybody knows , they ,of course, are experienced computer users. So they always communicate their new reaserches on ciyper by Internet. But now, unfortunetly, their country is suffering from a cruel war caused by nucleus. However the enemy state is so powerful much more than their motherland. So after several months Bob and Alice's country is controled by enemy on many areas, including network. Any communications on the network are highly suspiciously. If anybody uncareful,he may lost his life! This situation is so dangerious to computer users. So Bob's mother and Alice's father make a decision together for their childern --- forbid them to use computer again. Bob and Alice can't disobey this dicesion ,but they also don't want to pause their new research. So they also make a decison together --- to meet at somewhere personally ,and , of coure,don't let their parents konw.

Now , Bob and Alice fasten the last chance on network communication to confirm the place they will meet at in the next days. The city they lived , has many roads and hotels. Of course, they can't talk just on the roads, and they also can't enter any buildings except hotels. So they decide to meet in a certain hotel in their city. As they know,the city's building pattern is very regular like a rectangle with many griddings in it. And all hotels and houses are built in lines and columns, so are roads. So they can only walk straightly by lines or columns. While it is a mountainly city, every buliding may has a different height above sea level.If you walk form a hotel with a height x at an initial speed v0 to a hotel with a height y, then the speed on this road is surposed to be v0 × 2(x-y) . We already know that Bob lives in the city's left-up corner,and Alice lives in the right-down corner. The buliding in the grid among their houses are all hotels. and the length of the road between two neighbor( four directions connected) hotel is alway a same value L, and they set up at their own initial speed at the same time.

Now , they want to pick a path which will take them a fastest time to meet each other. Pitfully for them ,can you help them to commpute the minmum time to meet ? You should always remember that ,they only meet at a certain hotel ,so maybe one of them will reach a hotel and don't walk again to wait the other one to arrive.

Input
There will be more than a test case. every case data goes like below:

Line 1 : Four space-separated integers: N, Vb, Va, L.
N is the size of the rectangle of Bob and Alice's city. Va is Alice's initial speed, while Vb is Bob's initial speed. L is the length between two neighbor hotels .

Line 2 ~ Line N + 1 : every line has N space-separated integers,each one represents a hotel's height.

N = 0 indicates the end of input and should not be processed.

Output
For each case , ouput an interger in a separated line which is the time they take to meet each other.The answer must round to three decimal places.

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

Sample Output
4.000

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?