📄 toxophily_lzx.java
字号:
import java.io.*;
import java.math.*;
import java.util.Scanner;
import java.text.DecimalFormat;
public class Toxophily_lzx {
public static void main(String[] args) throws IOException {
final double epsilon = 1e-8;
final double g = 9.8;
Scanner in = new Scanner(System.in);
DecimalFormat ctrl = new DecimalFormat("0.000000");
int T = in.nextInt();
while (T-- > 0) {
double x = in.nextDouble(), y = in.nextDouble(), v = in.nextDouble();
if (v < epsilon) {
System.out.println(-1);
continue;
}
if (Math.abs(x) < epsilon) {
if (2 * g * y > v * v) {
System.out.println(-1);
}
else {
System.out.println(ctrl.format(Math.PI / 2));
}
continue;
}
double t = (g * x * x) / (v * v);
double delta = x * x - (2 * y + t) * t;
if (Math.abs(delta) < epsilon) {
System.out.println(ctrl.format(Math.atan(x / t)));
}
else if (delta < 0) {
System.out.println("-1");
}
else {
double res = Math.min(Math.atan((x - Math.sqrt(delta)) / t), Math.atan((x + Math.sqrt(delta)) / t));
System.out.println(ctrl.format(res));
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -