[Link] https://AtCoder.jp/contests/typical90/tasks/typical90_r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int time = atoi(br.readLine());
String[] tmp = br.readLine().split(" ");
double r = (double)atoi(tmp[0]) / 2;
int x = atoi(tmp[1]), y = atoi(tmp[2]);
int q = atoi(br.readLine());
for(int i = 0; i < q; i++) {
int elapse = atoi(br.readLine());
double proportion = (double)elapse / time, height = getH(proportion, r), distance = getDistance(proportion, r, x, y);
sb.append(Math.atan2(height, distance) / Math.PI * 180).append("\n");
}
System.out.print(sb);
}
static double getH(double proportion, double r) {
return r * (1 - Math.cos(2 * Math.PI * proportion));
}
static double getDistance(double proportion, double r, int x, int y) {
double yCord = - r * Math.sin(2 * Math.PI * proportion);
return Math.sqrt(Math.pow(Math.abs(yCord - y), 2) + (long)x * x);
}
static int atoi(String s) { return Integer.parseInt(s); }
}