杭电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 ...
随机推荐
- 垃圾回收GC:.Net自己主动内存管理 上(一)内存分配
垃圾回收GC:.Net自己主动内存管理 上(一)内存分配 垃圾回收GC:.Net自己主动内存管理 上(一)内存分配 垃圾回收GC:.Net自己主动内存管理 上(二)内存算法 垃圾回收GC:.Net自己 ...
- 自增锁ID复用问题
mysql> select * from pp; +----+------+ | id | name | +----+------+ | xx | | xx | | xx | | xx | | ...
- linux用户权限
Linux下passwd和shadow文件内容详解 一./etc/passwd/etc/passwd 文件是一个纯文本文件,每行采用了相同的格式: name:password:uid:gid:comm ...
- 【PHP代码审计】 那些年我们一起挖掘SQL注入 - 8.全局防护盲点的总结下篇
0x01 背景 现在的WEB应用对SQL注入的防护基本都是判断GPC是否开启,然后使用addlashes函数对单引号等特殊字符进行转义.但仅仅使用这样的防护是存在很多盲点的,接上篇http://www ...
- EF——继承映射关系TPH、TPT和TPC的讲解以及一些具体的例子 05 (转)
EF里的继承映射关系TPH.TPT和TPC的讲解以及一些具体的例子 本章节讲解EF里的继承映射关系,分为TPH.TPT.TPC.具体: 1.TPH:Table Per Hierarchy 这是EF ...
- 使用sharepreferce记录数组数据
使用sharepreferce记录数组数据 /** * * sharepreference纪录news数据 * * */ private static final String name=" ...
- [xPlugins] 开发中常用富文本编辑器介绍
富文本编辑器学习,常见富文本编辑器有: CKeditor(FCkeditor).UEditor(百度推出的).NicEdit.KindEditor CKEditor 即 FCKEditor FCKed ...
- 【Shell脚本学习10】Shell运算符:Shell算数运算符、关系运算符、布尔运算符、字符串运算符等
Bash 支持很多运算符,包括算数运算符.关系运算符.布尔运算符.字符串运算符和文件测试运算符. 原生bash不支持简单的数学运算,但是可以通过其他命令来实现,例如 awk 和 expr,expr 最 ...
- 【Linux/Ubuntu学习5】Ubuntu 下android 开发,eclipse不能识别手机
ubuntu下eclipse不能识别手机解决方法: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1) 在终端运行 lsusb 会发现结果 ...
- iOS 手势大全
1.Touch事件 //系统自动调用 //一个UITouch代表一根手指 按住option变成两根手指 //虽然是两个手指,但只执行一次触摸事件 - (void)touchesBegan:(NSSet ...