杭电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 ...
随机推荐
- 剑指 offer set 4 矩形覆盖
总结 1. 斐波那契数列的变形题, 但是稍有隐晦, 有点意思 2. 求解 f(3) 时, 最后一块矩形可以竖着放, 也可以两块矩形横着放, 分别对应于 f(2) 和 f(1) ------------ ...
- fcitx的安装_配置
sudo apt-get purger ibus 安装Fcitx:sudo apt-get install im-switch fcitx #修改当前用户的默认输入法, 具体看man im-switc ...
- 基于Bootstrap的jQuery开关按钮组合
Bootstrap是一款由Twitter推出的开源前端开发包,功能非常强大.今天我们要分享的这款jQuery开关按钮组合就是基于Bootstrap框架的,看了按钮的主题样式,也都是Bootstrap的 ...
- LeetCode26 Remove Duplicates from Sorted Array
题目: Given a sorted array, remove the duplicates in place such that each element appear only once and ...
- 关于InputStream 和String对象之间的相互转换
代码如下: package com.xin.stream; import java.io.BufferedReader; import java.io.ByteArrayInputStream; im ...
- 为Web Api 2认证服务器增加令牌刷新功能
Refresh tokens can potentially improve the situation but also increase complexity. A refresh token i ...
- 【阿里云产品公测】云引擎ACE -discuz安装
作者:阿里云用户云想未来 谢谢支持.为什么写的比较简单就是为方便新手谁想要很麻烦?亲测按这个教程可以安装成功!时间紧迫不发图片了纯原创 排版您请谅解 进入创建新应用的信息填写界面,此处需要填写一个赠送 ...
- 【Android 界面效果30】Android中ImageSwitcher结合Gallery展示SD卡中的资源图片
本文主要是写关于ImageSwitcher结合Gallery组件如何展示SDCard中的资源图片,相信大家都看过API Demo 中也有关于这个例子的,但API Demo 中的例子是展示工程中Draw ...
- Android 珍藏(二)
一.如何控制Android LED等?(设置NotificationManager的一些参数) 代码如下: final int ID_LED=19871103; NotificationManage ...
- python 基础——实现一个带缓存功能的函数
from functools import wraps def cache(func): data = {} @wraps(func) def wrapper(*args): if args in d ...