/* 自定義代碼塊樣式 */

herrDeng網內搜尋

自訂搜尋

Ads

2026年6月18日 星期四

LeetCode 1344 分針時針夾角:0ms 一行秒殺 (C++/Python)


0ms| 1-liner C++ Py3|1344. Angle Between Hands of a Clock
應徵程式設計師,也會問小學數學,不用懷疑。
-----
When applying for a programmer position, they'll ask you elementary school math questions, no doubt about it.

#leetcode #1liner  #cplusplus  #python #leetcode1344
[Py3 1-liner請進]

#anwendeng
class Solution:
    def angleClock(self, h: int, m: int) -> float:
        return 360-A if (A:=max(h*30.0, m*5.5)-min(h*30.0, m*5.5))>180 else A

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章