Submission #2709895


Source Code Expand

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        double n = scanner.nextDouble(); //時
        double m = scanner.nextDouble(); //分

        if (n>=12) {
        	n-=12;
        }

        double s = n * (360/12);
        s += 30 * (m/60);
        double l = m * (360/60);
        double ans;

        ans = Math.abs(s-l);
        if (ans > 180) {
        	ans =360-ans;
        }

        int tmp = (int)ans;
        double tmp2 = (double)tmp;

        if (ans == tmp2) {
        	System.out.println(tmp);
        }else {
        	System.out.println(ans);
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Submission Info

Submission Time
Task B - 時計盤
User HiroKata
Language Java8 (OpenJDK 1.8.0)
Score 100
Code Size 2025 Byte
Status AC
Exec Time 72 ms
Memory 23252 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 35
Set Name Test Cases
Sample subtask0_1.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt
All 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 30.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt
Case Name Status Exec Time Memory
0.txt AC 70 ms 21076 KB
1.txt AC 68 ms 19284 KB
10.txt AC 70 ms 19924 KB
11.txt AC 69 ms 21204 KB
12.txt AC 71 ms 18260 KB
13.txt AC 68 ms 17748 KB
14.txt AC 71 ms 21332 KB
15.txt AC 69 ms 19156 KB
16.txt AC 69 ms 18260 KB
17.txt AC 71 ms 22996 KB
18.txt AC 70 ms 20436 KB
19.txt AC 70 ms 21204 KB
2.txt AC 69 ms 18004 KB
20.txt AC 69 ms 21204 KB
21.txt AC 70 ms 18388 KB
22.txt AC 68 ms 19284 KB
23.txt AC 70 ms 17876 KB
24.txt AC 72 ms 19540 KB
25.txt AC 70 ms 18772 KB
26.txt AC 70 ms 18516 KB
27.txt AC 69 ms 19412 KB
28.txt AC 70 ms 18132 KB
29.txt AC 69 ms 19284 KB
3.txt AC 69 ms 18004 KB
30.txt AC 68 ms 17620 KB
4.txt AC 72 ms 20052 KB
5.txt AC 71 ms 21076 KB
6.txt AC 70 ms 18772 KB
7.txt AC 71 ms 21076 KB
8.txt AC 70 ms 18132 KB
9.txt AC 71 ms 20948 KB
subtask0_1.txt AC 69 ms 15828 KB
subtask0_2.txt AC 71 ms 23252 KB
subtask0_3.txt AC 69 ms 22484 KB
subtask0_4.txt AC 71 ms 18388 KB