-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAngle.java
More file actions
29 lines (26 loc) · 991 Bytes
/
Angle.java
File metadata and controls
29 lines (26 loc) · 991 Bytes
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
/**
* Created by MalhotR1 on 04/25/2017.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Angle {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine().trim());
for (float t = 0; t < T; t++) {
String[] in = br.readLine().trim().split(" ");
float h = Float.parseFloat(in[0]);
float m = Float.parseFloat(in[1]);
float a_m = (6 * m) % 360;
float a_h = 30 * h + (m * a_m) / 360;
float greater = Math.max(a_m, a_h);
float smaller = Math.min(a_m, a_h);
float angle = greater - smaller;
float angle2 = 360 - greater + smaller;
float res = Math.min(angle, angle2);
int res2 = (int) Math.floor(res);
System.out.println(res2);
}
}
}