Jiangxi University of Finance and Economics The First Programming Contest C - Chicken Tonight

Link: https://www.nowcoder.com/acm/contest/115/C
Source: Niuke.com

Topic description

There are still two people left in the final round, "Voldemort" XDD and FZL who ran into the circle. XDD took the sniper rifle AWM to aim and was ready to shoot the running FZL.
XDD knew that he only had one chance, if he made a mistake, he would be taken away by his big brother FZL with a 360-degree sniper shot in the air.
So can XDD eat chicken, please help him.
-------------------------------------------
For the convenience of analysis, the bullet, XDD, and FZL are assumed to be the origin, the bullet is shot horizontally, and the distance between FZL and XDD remains unchanged during the running process.
The acceleration of the falling bullet is 9.8 meters per second.
Give the distance of XDD and FZL floating point number L, the speed of the bullet floating point number V1, the speed of FZL running floating point number V2
XDD needs to know the falling distance L1 of the bullet and the running distance L2 of the FZL during the period from shooting to hitting the target, so as to predict the shooting position, please help him calculate.

Enter description:

Enter an integer T on the first line (representing the number of samples)
The next group T samples
One line per sample, including three floating-point numbers L V1 V2 (0<L,V1,V2<=10000)

Output description:

output T lines
Each test case outputs a line corresponding to the result
L1 L2 (separated by a space, the result retains 6 decimal places)
Example 1

enter

1
100 1000 10

output

0.049000 1.000000
The meaning of the title: XDD shoots FZL, the distance between the two remains unchanged during the shooting process, which is relatively static.

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n;
    double s,v1,v2;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>s>>v1>>v2;
        double t=s/v1;
        double s1=4.9*t*t;
        double s2=v2*t;
        printf("%.6lf %.6lf\n",s1,s2);
    }
return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324815290&siteId=291194637