当前位置:网站首页>1344. Included angle of clock pointer
1344. Included angle of clock pointer
2022-07-27 09:22:00 【Mr Gao】
1344. The angle between the hands of the clock
Here are two numbers for you hour and minutes . Please return to the clock , The angle of a small angle consisting of the hour hand and minute hand of a given time (60 The system of units ).
Example 1:
Input :hour = 12, minutes = 30
Output :165
Example 2:
Input :hour = 3, minutes = 30
Output ;75
Example 3:
Input :hour = 3, minutes = 15
Output :7.5
Example 4:
Input :hour = 4, minutes = 50
Output :155
Example 5:
Input :hour = 12, minutes = 0
Output :0
The question is very simple , In fact, it just needs some mathematical knowledge , The solution code is as follows :
double angleClock(int hour, int minutes){
double x=hour*5+minutes/60.0*5;
double y=minutes;
return fmin(fabs(x-y)*6,(60.0-fabs(x-y))*6);
}
边栏推荐
- Hard core structure, violent interpretation
- Mangodb简单使用
- Is the operation of assigning values to int variables atomic?
- BGP联邦实验
- npm install报错 强制安装
- QT uses SQLite to open multiple database files at the same time
- Cross domain and processing cross domain
- 【微服务~Sentinel】Sentinel之dashboard控制面板
- CUDA programming-04: CUDA memory model
- Activation functions commonly used in deep learning
猜你喜欢

ES6 new - object part

【微信小程序】农历公历互相转换

js call和apply

ES6 new - deconstruction assignment of array / object

pollFirst(),pollLast(),peekFirst(),peekLast()

C# 窗体应用常用基础控件讲解(适合萌新)

pollFirst(),pollLast(),peekFirst(),peekLast()

拍卖行做VC,第一次出手就投了个Web3

PVT's spatial reduction attention (SRA)

Five kinds of 3D attention/transformer finishing (a-scn, point attention, CAA, offset attention, point transformer)
随机推荐
基于ArkUI eTS开发的坚果食谱(NutRecipes
[C language - zero foundation lesson 7] sequential structure and selection structure
巴比特 | 元宇宙每日必读:广州南沙发布“元宇宙九条”措施,平台最高可获得2亿元资金支持...
IDL MODIS generate lookup table
[C language - zero basis _ study _ review _ lesson 5] operational properties of basic operators
Sentry 2 orbital data download
The third day of learning C language
ES6 new - deconstruction assignment of array / object
Mangodb简单使用
You haven't heard of such 6 question brushing websites, have you? Are you out?
【云原生之kubernetes实战】在kubernetes集群下部署Rainbond平台
[daily algorithm day 96] Tencent interview question: merge two ordered arrays
Restful
The execution sequence of async/await, macro tasks and micro tasks
Day 6 of learning C language
openharmony萌新贡献指南
IDL calls 6S atmospheric correction
如何注册码云账号
DNS域名空间
Data interaction based on restful pages