zoukankan      html  css  js  c++  java
  • ural 2022 Riding a Toad

    2022. Riding a Toad

    Time limit: 1.0 second
    Memory limit: 64 MB
    A tribe of leafmen live in the old forest. Leafmen are very tiny and fast, that’s why we can’t notice them even when they are under our very nose. Leafmen guard the forest unceasingly, protecting it from evil creatures.
    A young leafman Nod has occasionally found out that hostile tribe of boggans is planning to make a raid to leafmen’ palace and kidnap their queen. It’s urgent to warn general Ronin about this to make him send his warriors and tighten security of the palace. Nod whistled for his tame hummingbird, but it didn’t appear, it must have had gone hunting on blackflies. Then Nod saddled up a big toad and rode it towards the general’s garrison.
    Problem illustration
    The garrison is surrounded by a wall with width l. On the height h from the ground the wall has a small cylindrical hole with diameter d. This hole is used by leafmen to get inside flying on hummingbirds. But it’s not an easy thing for a toad to jump into it. Then to draw the guards’ attention Nod decides to take a small stone and throw it into the hole while the toad is jumping. The toad is at distance L from the wall and can make one jump with initial speed (vxvy). At any moment while the toad is in the air and its x coordinate is less than x coordinate of the wall outer surface Nod can throw a stone with an absolute initial speed (uxuy). The stone should fly into the hole not touching its floor or ceiling. Determine the moment when Nod should throw the stone.
    You may assume that both the toad and the stone are not affected by any powers except gravity, giving it down-directed acceleration g.

    Input

    The first line contains integers Lhld (1 ≤ Lhld ≤ 1000). The second line contains integers vxvyuxuy (1 ≤ vxvyuxuy ≤ 1000). X-axis is horizontal and directed towards the wall, Y-axis is up-directed. Let’s assume gravity acceleration equal 10. All distances are given in meters, all speeds in meters per second.

    Output

    If Nod can throw the stone into the hole output the moment of time when he should throw it with absolute or relative precision 10−6. The moment of the toad’s take-off should be taken as the initial moment. If there are several moments when it is possible to throw the stone output any of them. Your answer should be such that throwing the stone 10−6 second sooner or later it won’t touch the wall. It is guaranteed that if some answer exists then there is the answer satisfying this constraint. If it is not possible to throw the stone into the hole, output “-1”.

    Samples

    inputoutput
    4 2 2 4
    1 1 5 10
    
    0.1
    
    30 15 5 5
    10 10 20 10
    
    -1
    
    Problem Author: Nick Burlakov
    Problem Source: NEERC 2014, Eastern subregional contest
  • 相关阅读:
    java代码中的三元表达式
    RequestDispatcher用法
    SQL的分页算法
    “将截断字符串或二进制数据”错误分析
    SQL Server 2005中top关键字的用法
    rtems开发环境
    linux虚拟机无法识别u盘
    多核性能优化
    windows无法安全卸载u盘的老毛病
    关闭指定servcie日志
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790402.html
Copyright © 2011-2022 走看看