結果
問題 | No.1236 長針と短針 |
ユーザー | Theta |
提出日時 | 2022-11-02 17:01:53 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 1,071 bytes |
コンパイル時間 | 221 ms |
コンパイル使用メモリ | 10,964 KB |
実行使用メモリ | 8,120 KB |
最終ジャッジ日時 | 2023-09-24 05:55:31 |
合計ジャッジ時間 | 2,491 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,964 KB |
testcase_01 | AC | 17 ms
8,048 KB |
testcase_02 | AC | 16 ms
7,864 KB |
testcase_03 | AC | 18 ms
8,020 KB |
testcase_04 | AC | 17 ms
7,944 KB |
testcase_05 | AC | 16 ms
7,980 KB |
testcase_06 | AC | 17 ms
7,976 KB |
testcase_07 | AC | 18 ms
7,984 KB |
testcase_08 | AC | 17 ms
7,948 KB |
testcase_09 | AC | 17 ms
8,084 KB |
testcase_10 | AC | 16 ms
8,016 KB |
testcase_11 | AC | 17 ms
8,024 KB |
testcase_12 | AC | 16 ms
8,020 KB |
testcase_13 | AC | 17 ms
7,976 KB |
testcase_14 | AC | 16 ms
8,032 KB |
testcase_15 | AC | 16 ms
8,120 KB |
testcase_16 | AC | 18 ms
8,016 KB |
testcase_17 | AC | 17 ms
7,976 KB |
testcase_18 | AC | 17 ms
8,020 KB |
testcase_19 | AC | 18 ms
8,044 KB |
testcase_20 | AC | 17 ms
7,972 KB |
testcase_21 | AC | 17 ms
7,976 KB |
testcase_22 | AC | 18 ms
8,080 KB |
ソースコード
from math import floor def calc_short_degree(hour, minute, second) -> int: return (hour * 30) % 360 + minute/2 + second/120 def calc_long_degree(minute, second) -> int: return minute * 6 + second / 10 def main(): until_zero_minute_time = 0 A, B = map(int, input().split()) long_degree = calc_long_degree(B, 0) short_degree = calc_short_degree(A, B, 0) if long_degree == short_degree: print(0) return if long_degree > short_degree: until_zero_minute_time = (60 - B) * 60 long_degree = 0 short_degree = (A+1, 0, 0) B = 0 A += 1 for time in range(1, 3601): long_degree = calc_long_degree(B + time // 60, time % 60) short_degree = calc_short_degree(A, B + time // 60, time % 60) if long_degree > short_degree: print(until_zero_minute_time + time - 1) return if long_degree == short_degree: print(until_zero_minute_time + time) return raise ValueError if __name__ == "__main__": main()