hdoj 夹角有多大(题目已修改,注意读题) 2076 (数学&转换)
2016-04-02 21:00
489 查看
夹角有多大(题目已修改,注意读题)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13233 Accepted Submission(s): 5214
Problem Description
时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少。现在xhd知道的只有时间,请你帮他算出这个夹角。
注:夹角的范围[0,180],时针和分针的转动是连续而不是离散的。
Input
输入数据的第一行是一个数据T,表示有T组数据。
每组数据有三个整数h(0 <= h < 24),m(0 <= m < 60),s(0 <= s < 60)分别表示时、分、秒。
Output
对于每组输入数据,输出夹角的大小的整数部分。
Sample Input
2
8 3 17
5 13 30
Sample Output
138
75//没什么好讲的,应该都会推出来。但要注意最后得强制类型转换一下。
#include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #include<iostream> #define INF 0x3f3f3f3f #define ll long long #define IN __int64 #define N 1010 #define M 1000000007 using namespace std; int main() { int t; double h,m,s; scanf("%d",&t); while(t--) { double j1,j2; double mm,hh; scanf("%lf%lf%lf",&h,&m,&s); if(h>12) h-=12; mm=m+s/60;j1=mm*6; hh=h+mm/60;j2=hh*5*6; double ans=fabs(j1-j2); if(ans>180) printf("%d\n",(int)(360-ans)); else printf("%d\n",(int)ans); } return 0; }
相关文章推荐
- JAVA_基本LDAP操作实例
- js设计模式-门面模式
- JavaScript:对Dom的操作
- This version of the rendering library is more recent than your version of ADT plug-in. Please update
- This version of the rendering library is more recent than your version of ADT plug-in. Please update
- 咩咩咩~原来白羊是这样的!!
- 苹果开发工具:Xcode和Interface Builder
- dubbo管理控制台
- ssh 证书方式远程登陆linux主机
- IOS 使用Interface Builder开发界面入门与技巧
- 0402第五周学习进度条
- Java 内存区域和GC机制(上)
- js笔记(9)之定时器&&数字时钟&&延时提示框
- Java-Arrays的工具类
- UVA 1395 Slim Span 最小生成树
- UVA 1395 Slim Span 最小生成树
- POJ1287 Networking(最小生成树)
- 路径还原
- HDU 1012
- SSO单点登录