杭电ACM2076--夹角有多大(题目已修改,注意读题)
杭电ACM2076--夹角有多大(题目已修改,注意读题)
http://acm.hdu.edu.cn/showproblem.php?pid=2076
思路很简单。直接贴代码。过程分析有点耗时间。
// #include <stdio.h>
// #include <math.h>
// int main()
// {
// int t;
// double h,m,s;
// //int h,m,s;
// int z;
// scanf("%d",&t);
// while (t--)
// {
// z = 0;
// scanf("%lf%lf%lf",&h,&m,&s);
// //scanf("%d%d%d",&h,&m,&s);
// //printf("asdf");
//
// z = (int)((h+(m+s/60)/60)*360/12-((m+s/60)*360/60)-0.5);
// if (z<0)
// {
// z = -z;
// }
// else if (z>180)
// {
// z = 360-z;
// }
// printf("%d\n",z);
// }
// return 0;
// } /*
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
//#include<map>
#include<sstream>
#include<set>
#include<queue>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
using namespace std;
const double pi = acos(-1.);
int a[100010];
int main()
{
int t;
while(~scanf("%d",&t))
{
while(t--)
{
int h,s,m;
double ans1,ans2;
scanf("%d%d%d",&h,&m,&s);
if(h>=12) h-=12;
ans1=(h+(m*1.0/60)+(s*1.0/3600))*30;//先算时针夹角
ans2=(m+(s*1.0/60))*6;//再算分针
if(fabs(ans1-ans2)>180)
{
printf("%d\n",int(360-(fabs(ans1-ans2))));
}
else
{
printf("%d\n",int(fabs(ans1-ans2)));
}
}
}
return 0;
}
*/ #include <stdio.h>
#include <math.h>
int main()
{
int t;
int h,s,m;
double ans1,ans2;
scanf("%d",&t);
while (t--)
{
scanf("%d%d%d",&h,&m,&s);
if (h>=) h = h-;
ans1 = (h+(m*1.0/)+(s*1.0/))*;
ans2 = (m+(s*1.0/))*;
if(fabs(ans1-ans2)>)
{
printf("%d\n",int(-(fabs(ans1-ans2))));
}
else
{
printf("%d\n",int(fabs(ans1-ans2)));
}
}
}
杭电ACM2076--夹角有多大(题目已修改,注意读题)的更多相关文章
- HDOJ 2076 夹角有多大(题目已修改,注意读题)
Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出 ...
- HDU 2076 夹角有多大(题目已修改,注意读题)
Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出 ...
- HDUOJ--2079选课时间(题目已修改,注意读题)
选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu 2079 选课时间(题目已修改,注意读题)
http://acm.hdu.edu.cn/showproblem.php?pid=2079 背包 #include <cstdio> #include <cstring> # ...
- hdu2079 选课时间(题目已修改,注意读题) 母函数
计算数的和的种类,母函数裸题 #include<stdio.h> #include<string.h> ],c2[],a,b; int main(){ int T; while ...
- hdu 2079 选课时间(题目已改动,注意读题) (母函数)
代码: #include<cstdio> #include<cstring> using namespace std; int main() { int t; scanf(&q ...
- 杭电ACM2080--夹角有多大II
http://acm.hdu.edu.cn/showproblem.php?pid=2080 /* //Author:nunu // #include <stdio.h> #include ...
- HDU 2076 夹角有多大
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2076 夹角有多大(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java ...
- 杭电oj2064、2067、2068、2073、2076-2078、2080、2083-2085
2064 汉诺塔III #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d",&a ...
随机推荐
- 三星Galaxy S4(GT-I9500)获取ROOT权限教程(转)
http://news.candou.com/2013-05-20/453695_1.shtml 获取root权限的方法
- Linux文件空洞与稀疏文件 转
1.Linux文件空洞与稀疏文件 2.文件系统数据存储 3.文件系统调试 文件空洞 在UNIX文件操作中,文件位移量可以大于文件的当前长度在这种情况下,对该文件的下一次写将延长该文件,并在 ...
- NHibernate教程
NHibernate教程 一.NHibernate简介 在今日的企业环境中,把面向对象的软件和关系数据库一起使用可能是相当麻烦.浪费时间的.NHibernate是一个面向.Net环境的对象/关系数据库 ...
- 深入理解Redis中的主键失效及其实现机制
参考:http://blog.sina.com.cn/s/articlelist_1221155353_0_1.html 作为一种定期清理无效数据的重要机制,主键失效存在于大多数缓存系统中,Reids ...
- QQ会员AMS平台PHP7升级实践
作者:徐汉彬链接:https://zhuanlan.zhihu.com/p/21493018来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. QQ会员活动运营平台(AMS ...
- tachyon 集群容错
集群容错就是HA.这次顺带也练一下hadoop的HA 环境: centos6.5+jdk1.7+hadoop2.2.0+tachyon0.5.0+zookeeper3.4.6 hadoop 192.1 ...
- C. Mobile phones
Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows ...
- Android小项目之八 界面细节
------- 源自梦想.永远是你IT事业的好友.只是勇敢地说出我学到! ---------- 按惯例,写在前面的:可能在学习Android的过程中,大家会和我一样,学习过大量的基础知识,很多的知识点 ...
- ajax 请求
案例: <html><head><script type="text/javascript">function loadXMLDoc(){var ...
- 把txt文件中的json字符串写到plist文件中
- (void)json2Plist { NSString *filePath = [self applicationDocumentsDirectoryFileName:@"json&qu ...