[Offer收割]编程练习赛24 register

Ended

Participants:356

Verdict:Accepted
Score:100 / 100
Submitted:2017-08-27 13:48:07

Lang:Java

Edit
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
31
import java.text.DecimalFormat;
import java.util.*;
// 60.11/120
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            long[][] hmss = new long[n][4];
            for (int i = 0i < ni++) {
                hmss[i][0= in.nextLong();
                hmss[i][1= in.nextLong();
                hmss[i][2= in.nextLong();
                hmss[i][3= in.nextLong();
                double total = hmss[i][0* 3600 + hmss[i][1* 60 + hmss[i][2+ hmss[i][3];
                double h = total / 120 % 360;
                double m = total / 10 % 360;
                double ans = Math.abs(h - m);
                if (ans > 180) {
                    ans = 360 - ans;
                }
                DecimalFormat decimalFormat = new DecimalFormat(".0000");
                String st = decimalFormat.format(ans);
                if (ans < 1) {
                    st = "0" + st;
                }
                System.out.println(st);
            }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX