結果

問題 No.1236 長針と短針
ユーザー keijakkeijak
提出日時 2020-09-25 22:30:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 893 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-10 15:50:05
合計ジャッジ時間 1,553 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 AC 16 ms
7,888 KB
testcase_03 AC 16 ms
7,820 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 16 ms
7,824 KB
testcase_06 AC 17 ms
7,804 KB
testcase_07 AC 16 ms
7,936 KB
testcase_08 AC 16 ms
7,836 KB
testcase_09 AC 16 ms
7,916 KB
testcase_10 AC 16 ms
7,884 KB
testcase_11 AC 16 ms
7,792 KB
testcase_12 AC 16 ms
7,824 KB
testcase_13 AC 16 ms
7,788 KB
testcase_14 AC 16 ms
7,808 KB
testcase_15 AC 17 ms
7,936 KB
testcase_16 AC 16 ms
7,828 KB
testcase_17 AC 16 ms
7,876 KB
testcase_18 AC 16 ms
7,820 KB
testcase_19 AC 16 ms
7,868 KB
testcase_20 AC 16 ms
7,932 KB
testcase_21 AC 16 ms
7,808 KB
testcase_22 AC 16 ms
7,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

A, B = inl()


def solve():
    xt = [(24, 0)]
    for h in range(24):
        if h in [11, 23]:
            continue
        if h in [0, 12]:
            xt.append((h, 0))
            continue
        fv, tv = 0.0, 60.0
        for i in range(50):
            mid = (fv + tv) / 2
            if 60 * (h % 12) <= 11 * mid:
                tv = mid
            else:
                fv = mid
        xt.append((h, tv))

    s = 60 * A + B
    ans = 10 ** 9
    for (h, m) in xt:
        t = h * 60 + m
        if t < s:
            continue
        ans = min(ans, int((t - s) * 60))

    return ans


print(solve())
0