hdu 1006 Tick and Tick
Tick and Tick
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 19764 Accepted Submission(s):
5164
and meeting each other many times everyday. Finally, they get bored of this and
each of them would like to stay away from the other two. A hand is happy if it
is at least D degrees from any of the rest. You are to calculate how much time
in a day that all the hands are happy.
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.
120
90
-1
0.000
6.251
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <cmath>
using namespace std;
double D;
double sum;
struct node
{
double l,r;
};
node ans[][];
node solve(double a,double b)
{
node qu;
if(a>)
{
qu.l=(D-b)/a;
qu.r=(-D-b)/a;
}
else
{
qu.l=(-D-b)/a;
qu.r=(D-b)/a;
}
if(qu.l<) qu.l=;
if(qu.r>) qu.r=;
if(qu.l>=qu.r) { qu.l=qu.r=;}
return qu;
}
node mer_g(node a,node b)
{
node q;
q.l=max(a.l,b.l);
q.r=min(a.r,b.r);
if(q.l>q.r) q.l=q.r=;
return q;
}
int main()
{
int h,m;
int i,j,k;
double a1,a2,a3,b1,b2,b3;
while(scanf("%lf",&D),D!=-)
{
sum=;
node qu;
for(h=;h<;h++)
for(m=;m<;m++)
{
b1=m*; a1=-5.9;
b2=*h+(0.5-)*m; a2=1.0/-0.1;
b3=*h+0.5*m; a3=1.0/-;
ans[][]=solve(a1,b1);ans[][]=solve(-a1,-b1);
ans[][]=solve(a2,b2);ans[][]=solve(-a2,-b2);
ans[][]=solve(a3,b3);ans[][]=solve(-a3,-b3);
for(i=;i<;i++)
for(j=;j<;j++)
for(k=;k<;k++)
{
qu=mer_g(mer_g(ans[][i],ans[][j]),ans[][k]);
sum+=qu.r-qu.l;
}
}
printf("%.3lf\n",sum*/);
}
return ;
}
hdu 1006 Tick and Tick的更多相关文章
- 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 有技巧的暴力
Tick and Tick Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- hdu1006 Tick and Tick
原题链接 Tick and Tick 题意 计算时针.分针.秒针24小时之内三个指针之间相差大于等于n度一天内所占百分比. 思路 每隔12小时时针.分针.秒针全部指向0,那么只需要计算12小时内的百分 ...
- HDU 1006 模拟
Tick and Tick Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 1006 [Tick Tick]时钟问题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1006 题目大意:钟表有时.分.秒3根指针.当任意两根指针间夹角大于等于n°时,就说他们是happy的, ...
- HDU 1006 Tick and Tick 解不等式解法
一開始思考的时候认为好难的题目,由于感觉非常多情况.不知道从何入手. 想通了就不难了. 能够转化为一个利用速度建立不等式.然后解不等式的问题. 建立速度,路程,时间的模型例如以下: /******** ...
- [ACM_模拟] HDU 1006 Tick and Tick [时钟间隔角度问题]
Problem Description The three hands of the clock are rotating every second and meeting each other ma ...
- 1006 Tick and Tick
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1006 题意: 24小时中,三个指针之间超过某个度数的时间占所有时间的百分比是多少. 思路:主要是物理和数学 ...
随机推荐
- msyql的子查询,或者叫嵌套查询
INNER和OUTER可以省略
- web+页面支持批量下载吗
一.此方法火狐有些版本是不支持的 window.location.href = 'https://*****.oss-cn-**.aliyuncs.com/*********';二.为了解决火狐有些版 ...
- 「学习笔记」FFT及NTT入门知识
前言 快速傅里叶变换(\(\text{Fast Fourier Transform,FFT}\) )是一种能在\(O(n \log n)\)的时间内完成多项式乘法的算法,在\(OI\)中的应用很多,是 ...
- base/7/x86_64/filelists_db FAILED
解决办法: [root@localhost ~]# cd /var/lib/rpm [root@localhost rpm]# rm -rf __db.* # 清除原 rpmdb 文件 [root ...
- mysql my.cnf文件
一.mysqld组值设置: 1.user = mysql #启动mysql的用户.2.pid-file = /var/run/mysqld/mysqld.pid #指定pid文件.3.socket = ...
- Jenkins部署maven项目到远端服务器
jenkins服务器地址:192.168.1.203 项目部署机器地址:192.168.1.201,192.168.1.200 代码托管github 虽然比较low,但是入门是可以的! Jenkins ...
- 【python代码】linux 登陆网关
#!/usr/bin/env python import urllib2 url="http://10.3.8.211" data="DDDDD=2010111222&a ...
- python 将数据写入excel
摘要链接: python第三方库——xlrd和xlwt操作Excel文件学习 :http://blog.csdn.net/wangkai_123456/article/details/50457284 ...
- CentOS 7下安装Redis
1.安装gcc环境 sudo yum install gcc-c++ 2.安装wget sudo yum install wget 3.下载Redis源码包 wget http://download. ...
- 26Flutter 日期 和时间戳/格式化日期库/flutter异步/ 官方自带日期组件showDatePicker、时间组件showTimePicker以及国际化
/* 一.Flutter日期和时间戳 日期转换成时间戳 var now=newDateTime.now(); print(now.millisecondsSinceEpoch); //单位毫秒,13位 ...