请计算出时钟的时针和分针的角度(两个角度的较小者,四舍五入)。时间以HH:mm的格式传入。
angle(‘12:00’) // 0
angle(‘23:30’) // 165
/*** @param {string} time* @returns {number}**/function angle(time) {let [h, m] = time.split(':')h = Math.abs(h%12)let hR = (h / 12 + m / 60 / 12) * 360if(hR===360) hR = 0let mR = m / 60 * 360let res = Math.abs(hR - mR)return Math.round(res > 180? 360 - res : res)}
