Leetcode - Third Maximum Number
Leetcode - Unique Email Addresses

Leetcode - Angle Between Hands of a Clock

violet posted @ Jul 15, 2020 01:29:39 AM in 算法 with tags Algorithm Golang math , 314 阅读

https://leetcode.com/problems/angle-between-hands-of-a-clock/

Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand.

 

Example 1:

Input: hour = 12, minutes = 30
Output: 165

 

func angleClock(hour int, minutes int) float64 {
    hourDelta := (float64(minutes)/60)*30
    hourA := float64(hour)*30 + hourDelta
    minuteA := (float64(minutes)/60)*360
    if abs(minuteA - hourA) > 180 {
        if minuteA > hourA {
            return abs(minuteA - hourA - 360)
        } else {
            return abs(hourA - minuteA - 360)
        }
    }
    return abs(minuteA - hourA)
}

func abs(a float64) float64 {
    if a < 0 {
        return 0 - a
    }
    return a
}
BSNL Customer Care n 说:
Aug 10, 2022 01:37:39 AM

The new digital era based support system contributing a lion’s sharing related to all telecom services in 2021 calendar year, also find the new email address providing BSNL complaint process for payment failed issues for any digital payment service failure related issues like repayment, The new digital era based support system contributing a lion’s sharing related to all telecom services in 2021 calendar year, BSNL Customer Care number refund of debited amount and service activation /deactivation, complaints, tariff change requests.

SBT Online 说:
Nov 09, 2022 04:38:52 PM

SBT bank (State Bank of Travancore) was among Indian best and major banking facility established in 1945. The Bank’s headquartered in Thiruvananthapuram, Kerala. The State Bank of Travancore later merged with State bank of India SBI making a strong collaboration. The Bank offers different banking services to millions of customers in the country with over 15,000 branches. SBT Online SBI bank has five major associates, one being the state bank of Travancore.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter