Tick and Tick
single line with a real number D between 0 and 120, inclusively. The input is
terminated with a D of -1.
time in a day that all of the hands are happy, accurate up to 3 decimal
places.
#include"iostream"
using namespace std;
inline double max(double a,double b,double c)
{
a=a>b?a:b;
a=a>c?a:c;
return a;
}
inline double min(double a,double b,double c)
{
a=a<b?a:b;
a=a<c?a:c;
return a;
}
int main()
{
double an;
double tsm[],tsh[],tmh[];
double s,m,h;
s=3600.00/;//周期结束点
m=43200.00/;
h=43200.00/;
while(cin>>an&&an!=-)
{
tsm[]=(*an)/;
tsh[]=(*an)/;
tmh[]=(*an)/;
tsm[]=s-tsm[];
tsh[]=m-tsh[];
tmh[]=h-tmh[];
double sum=;
double x=,y=;
int i,j;
for(i=,j=;;i+=,j+=)
{
tsm[i]=tsm[i-]+s;
tsm[j]=tsm[j-]+s;
if(tsm[i]>&&tsm[j]>)
break;
}
for(i=,j=;;i+=,j+=)
{
tsh[i]=tsh[i-]+m;
tsh[j]=tsh[j-]+m;
if(tsh[i]>&&tsh[j]>)
break;
}
for(i=,j=;;i+=,j+=)
{
tmh[i]=tmh[i-]+h;
tmh[j]=tmh[j-]+h;
if(tmh[i-]>&&tmh[j]>)
break;
}
int a[],b[],c[];
a[]=b[]=c[]=;
a[]=b[]=c[]=;
while(x<=&&y<=)
{
x=max(tsm[a[]],tsh[b[]],tmh[c[]]);
y=min(tsm[a[]],tsh[b[]],tmh[c[]]);
if(x<y)
sum+=(y-x);
if(y==tsm[a[]])
{
a[]+=;
a[]+=;
}
if(y==tsh[b[]])
{
b[]+=;
b[]+=;
}
if(y==tmh[c[]])
{
c[]+=;
c[]+=;
}
}
cout.precision();
cout<<fixed<<sum/<<endl;
}
return ;
}
Tick and Tick的更多相关文章
- hdu1006 Tick and Tick
原题链接 Tick and Tick 题意 计算时针.分针.秒针24小时之内三个指针之间相差大于等于n度一天内所占百分比. 思路 每隔12小时时针.分针.秒针全部指向0,那么只需要计算12小时内的百分 ...
- HDU 1006 Tick and Tick 时钟指针问题
Tick and Tick Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- hdu 1006 Tick and Tick 有技巧的暴力
Tick and Tick Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 1006 Tick and Tick(时钟,分钟,秒钟角度问题)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1006 Tick and Tick Time Limit: 2000/1000 MS (Java/Oth ...
- hdu 1006 Tick and Tick
Tick and Tick Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- hdu_1006 Tick and Tick(暴力模拟)
hdu1006 标签(空格分隔): 暴力枚举 好久没有打题了,退队了有好几个月了,从心底不依赖那个人了,原来以为的爱情戏原来都只是我的独角戏.之前的我有时候好希望有个人出现,告诉自己去哪里,做什么,哪 ...
- 1006 Tick and Tick
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1006 题意: 24小时中,三个指针之间超过某个度数的时间占所有时间的百分比是多少. 思路:主要是物理和数学 ...
- [ACM_模拟] HDU 1006 Tick and Tick [时钟间隔角度问题]
Problem Description The three hands of the clock are rotating every second and meeting each other ma ...
- hdu1006 Tick and Tick (数学题 借鉴了大神的博客)
先缩短一半的时间:早上的12个小时和下午的12小时对时钟是一样的,因为时钟12小时与0小时的三针位置相同.接着就是了解到每次所有的针从有重合到再次有重合至多有一段连续的段符合三针分离度大于n.所以只要 ...
随机推荐
- cocos2d-x 不能在android真机debug的问题
最近在做cocos2d-x开发的时候,发现在android真机上不能调试C++代码,显示如下警告信息 Ignoring packet error, continuing... warning: unr ...
- bzoj 3275 Number(最小割)
[题意] 给定n个数,要求选出一些数满足 1.存在c,a*a+b*b=c*c 2.gcd(a,b)=1 使得和最大. [思路] 二分图的最大权独立集(可以这么叫么QAQ 先拆点,对于不满足条件的两个 ...
- [HIve - LanguageManual] LateralView
Lateral View Syntax Description Example Multiple Lateral Views Outer Lateral Views Lateral View Synt ...
- HDU-4749 Parade Show KMP算法 | DP
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4749 题意:给两个串S和P,求S串中存在多少个与P串的大小关系一样的串. 因为数字的范围是1<= ...
- iOS 开发的9个超有用小技巧
http://www.jianshu.com/p/221507eb8590 1.如何快速的查看一段代码的执行时间. 1 2 #define TICK NSDate *startTime = [NS ...
- Spring EL Lists, Maps example
In this article, we show you how to use Spring EL to get value from Map and List. Actually, the way ...
- datasnap的前世今生
随着XE6,XE7,以及半年以后即将发布的XE8,DATASNAP将顺应跨平台的需要, 有可能的情况是这样的:XE8,DATASNAP写的中间件将可以运行在LINUX服务器上面. 大家都知道COM是W ...
- POJ 2762 Going from u to v or from v to u? (强连通分量缩点+拓扑排序)
题目链接:http://poj.org/problem?id=2762 题意是 有t组样例,n个点m条有向边,取任意两个点u和v,问u能不能到v 或者v能不能到u,要是可以就输出Yes,否则输出No. ...
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
- CommandLine 和 Options
用到的jar包 <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli& ...