当前位置:网站首页>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);
}
边栏推荐
- Save Xiaoyi from Netease written test -- a typical application of Manhattan distance
- Detailed explanation of two methods of Sqlalchemy
- DNS域名空间
- pollFirst(),pollLast(),peekFirst(),peekLast()
- 如何注册码云账号
- linux安装和远程连接mysql记录
- NCCL 集合通信--Collective Operations
- Two tips in arkui framework
- Day 7 of learning C language
- ArkUI中的显式动画
猜你喜欢

8 kinds of visual transformer finishing (Part 1)

NPM install error forced installation

8 kinds of visual transformer finishing (Part 2)

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

Hard core structure, violent interpretation
![Software testing function testing a full set of common interview questions [function testing - zero foundation] essential 4-1](/img/1c/c1c1b15e502ee901a396840c01e84d.png)
Software testing function testing a full set of common interview questions [function testing - zero foundation] essential 4-1

C language takes you to tear up the address book

巴比特 | 元宇宙每日必读:广州南沙发布“元宇宙九条”措施,平台最高可获得2亿元资金支持...

IDL 6S lookup table

【微服务~Sentinel】Sentinel之dashboard控制面板
随机推荐
【每日算法Day 94】经典面试题:机器人的运动范围
Flex layout (actual Xiaomi official website)
基于ArkUI eTS开发的坚果笑话(NutJoke)
拍卖行做VC,第一次出手就投了个Web3
Day 8 of learning C language
The fourth day of learning C language
IDL 6S lookup table
基于restful页面数据交互
[C language - zero foundation lesson 10] adventure of array Kingdom
8 kinds of visual transformer finishing (Part 2)
【微服务~Sentinel】Sentinel之dashboard控制面板
Restful
Ztree custom title attribute
Save Xiaoyi from Netease written test -- a typical application of Manhattan distance
Principle of flex:1
Wechat applet 5 - foundation strengthening (not finished)
MySQL transaction
Day 7 of learning C language
openharmony萌新贡献指南
[micro service ~sentinel] sentinel dashboard control panel