#include <cstdio>
#include <algorithm>
using namespace std;
const double UB=43200;
const double hm=11.0/120,hs=719.0/120,sm=59.0/10;
const double T_hm=UB/11,T_hs=UB/719,T_sm=3600.0/59;
int main()
{
double d;
double s[3],e[3],ts[3],te[3];
while(scanf("%lf",&d),d!=-1)
{
s[0]=d/hm;
s[1]=d/hs;
s[2]=d/sm;

e[0]=(360-d)/hm;
e[1]=(360-d)/hs;
e[2]=(360-d)/sm;

double sum=0;
for(ts[0]=s[0],te[0]=e[0];ts[0]<UB;ts[0]+=T_hm,te[0]+=T_hm)
{
if(te[0]>UB) te[0]=UB;
for(ts[1]=s[1],te[1]=e[1];ts[1]<UB;ts[1]+=T_hs,te[1]+=T_hs)
{
if(ts[1]>te[0])
break;
if(te[1]<ts[0])
continue;
if(te[1]>UB) te[1]=UB;
for(ts[2]=s[2],te[2]=e[2];ts[2]<UB;ts[2]+=T_sm,te[2]+=T_sm)
{
if(ts[2]>te[1]||ts[2]>te[0])
break;
if(te[1]<ts[0]||te[2]<ts[1])
continue;
if(te[2]>UB) te[2]=UB;
double start=max(max(ts[0],ts[1]),ts[2]);
double end=min(min(te[0],te[1]),te[2]);

if(end>start)sum+=end-start;
}
}
}
printf("%.3f\n",sum*100.0/UB);
}
return 0;
}

HDOJ1006的更多相关文章

随机推荐

  1. TOJ 2541: Paper Cutting

    2541: Paper Cutting  Time Limit(Common/Java):1000MS/10000MS     Memory Limit:65536KByteTotal Submit: ...

  2. 一堆Offer怎么选?这样做就不纠结了

    有个朋友,工作了10年左右,春节后换工作,拿了三个Offer(西安): 通信行业的一家研究所,软件开发工程师,月薪7K,承诺有月奖金.年终奖金 一家做大数据的公司,软件开发工程师,月薪15K,13薪 ...

  3. .NET重构(二):ArrayList,List,IList的联系和区别

    导读:在机房重构的时候,为了降低耦合,不能返回DataTable型数据,而需要转换为泛型集合.我一直使用的就是IList,那天师傅过来帮我挑错,问我:你为什么一直写IList呢,不应该是List吗?好 ...

  4. tab栏切换效 简易效果

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  5. 【Luogu】P2158仪仗队(欧拉函数)

    题目链接 首先来介绍欧拉函数. 设欧拉函数为f(n),则f(n)=1~n中与n互质的数的个数. 欧拉函数有三条引论: 1.若n为素数,则f(n)=n-1; 2.若n为pa,则f(n)=(p-1)*(p ...

  6. BZOJ 4568 [Scoi2016]幸运数字 ——线性基 倍增

    [题目分析] 考虑异或的最大值,维护线性基就可以了. 但是有多次的询问,树剖或者倍增都可以. 想了想树剖动辄数百行的代码. 算了,我还是写倍增吧. 注:被位运算和大于号的优先级坑了一次,QaQ [代码 ...

  7. springmvc接口接收json类型参数设置

    Springmvc需要如下配置: 1.开启注解 <!-- 开启注解--> <mvc:annotation-driven /> 2.加入相关bean <bean class ...

  8. 将SSM架构中原来关于springSecurity3.x版本的写法配迁移到SpringBoot2.0框架中出现的问题解决记

    迁移过程中关于这个安全框架的问题很麻烦,springBoot自带的stater中的版本是5.0,原来系统有通过实现"org.springframework.security.authenti ...

  9. shell的while/for脚本的简单入门

    shell的while/for脚本的简单入门 while [condition] dodone关键字break跳出循环,continue跳过循环的余下部分. for var in ...;do...d ...

  10. poj 3461 hash解法

    字符串hash https://blog.csdn.net/pengwill97/article/details/80879387 https://blog.csdn.net/chaiwenjun00 ...