結果
問題 | No.1236 長針と短針 |
ユーザー |
![]() |
提出日時 | 2020-09-25 21:30:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 668 bytes |
コンパイル時間 | 2,128 ms |
コンパイル使用メモリ | 74,628 KB |
実行使用メモリ | 37,188 KB |
最終ジャッジ日時 | 2024-06-28 06:08:50 |
合計ジャッジ時間 | 4,311 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int a = Integer.parseInt(sa[0]); int b = Integer.parseInt(sa[1]); br.close(); a %= 12; int x = 60 * 60 * 12; int[] y = new int[12]; for (int i = 0; i < 12; i++) { y[i] = x * i / 11; } int ans = Integer.MAX_VALUE; int t = 3600 * a + 60 * b; for (int i = 0; i < 12; i++) { int d = y[i] - t; if (d >= 0) { ans = Math.min(ans, d); } } System.out.println(ans); } }