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
  • 相关阅读:
    C# 图像处理:记录图像处理时间的一个类
    C# 图像处理:将图像(24位真彩)转为 8位灰度图像 采用了内存法,大大提高了效率
    C# 图像处理:复制屏幕到内存中,拷屏操作
    C# 图像处理:Bitmap 与 Image 之间的转换
    C# 图像处理:获取鼠标位置信息(全局)
    C# Liseview的使用方法之一:滚动到选中的行
    C# windows服务:如何获取服务程序所在的文件夹
    C#自制Web 服务器开发:mysql免安装版配置步骤详解分享
    C#自制Web 服务器开发:用C#开发自己的Web服务器
    ROS:ROS操作类MK.cs
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790402.html
Copyright © 2011-2022 走看看