UVA 12901 Refraction 数学
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83008#problem/E
Description



HINT
题意:
给你一个水池,水池中放一个东西,上面一双眼睛,问眼睛能看到东西时,水面的最小高度
题解:
列列方程就是了
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 2000001
#define mod 1000000007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** double w,h,x,xe,ye,p; int main()
{
int t=read();
while(t--)
{
cin>>w>>h>>x>>xe>>ye>>p;
double tan1=(xe-w)/(ye-h);
double tan2=tan(asin(sin(atan(tan1))/p)); double x1=w-tan1*h;
double ans=(x-x1)/(tan1-tan2);
if(ans<=)
cout<<"0.0000"<<endl;
else if(ans>h)
cout<<"Impossible"<<endl;
else
printf("%.4f\n",ans);
}
}
UVA 12901 Refraction 数学的更多相关文章
- UVA 12901 Refraction 几何/大雾题
Refraction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.a ...
- UVA 12901 Refraction 折射 (物理)
一道物理题,解个2次方程就行了... 求h最小的情况对应如下图所示 做法不唯一,我想避免精度损失所以在化简的时候尽可能地去避免sqrt和浮点数乘除. 似乎精度要求很低,直接用角度算也可以 #inclu ...
- UVA 10089 Repackaging 数学问题
大致题意:给出几个包裹,每个包裹都包装好了3种大小的杯子.现在要重新包装,使向量 a[1]*(s[1][1],s[1][2],s[1][3])+a[2]*(s[2][1],s[2][2],s[2][3 ...
- 紫书 例题 10-16 UVa 12230(数学期望)
感觉数学期望的和化学里面求元素的相对原子质量的算法是一样的 就是同位素的含量乘上质量然后求和得出 这道题因为等待时机是0到2*l/v均匀分配的,所以平均时间就是l/v 再加上过河的l/v, 最后加上步 ...
- UVa 10323 【数学】
UVa 10323 题目:计算阶乘在10000~6227020800之间的值,不在范围对应输出Under或者Over. 分析:简单题.数论.因为13!=6227020800,7!<10000&l ...
- UVa第十章数学概念与方法
Bryce1010模板 10.1数论初步 1.欧几里得算法和唯一分解定理 2.Eratosthenes筛法 补充素数筛选 const int MAXN=1e6+10; ll prime[MAXN]; ...
- UVA 10025(数学)
The ? 1 ? 2 ? ... ? n = k problem The problem Given the following formula, one can set operators ' ...
- UVA 11346 - Probability 数学积分
Consider rectangular coordinate system and point L(X, Y ) which is randomly chosen among all pointsi ...
- UVA 11971 - Polygon 数学概率
Polygon John has been given a segment of lenght N, however he n ...
随机推荐
- XsltListViewWebPart 和自定义列表视图
http://msdn.microsoft.com/zh-cn/library/ff806162(v=office.14).aspx
- (转载)让XCode运行时自动更新资源
转自http://goldlion.blog.51cto.com/4127613/1351616 用过XCode的人都知道,XCode有一个臭名昭著的bug——除非你修改了源代码造成了重新编译,否则游 ...
- ACM/ICPC 之 一道不太简单的DP面试题(Geeksforgeeks)
题面来源:geeksforgeeks/1993 题解:geeksforgeeks 题目简述:给一个m*n的矩阵,计算从(1,1)到(m,n)的所有不回退路径中,经过k次转向后的路径有多少条 输入T个样 ...
- Java for LeetCode 228 Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...
- Match:Milking Grid(二维KMP算法)(POJ 2185)
奶牛矩阵 题目大意:给定一个矩阵,要你找到一个最小的矩阵,这个矩阵的无限扩充的矩阵包含着原来的矩阵 思路:乍一看这一题确实很那做,因为我们不知道最小矩阵的位置,但是仔细一想,如果我们能把矩阵都放在左上 ...
- Mysql 基础2
创建数据库: create database/*条件*/+ text3/*数据库名称*/ 创建数据库 步骤:查询 创建查询 查询编辑器 (写代码) 删除数据库: drop datab ...
- xp系统打开软件程序总是弹出警告窗口,很烦人对不,怎么办呢?进来看
为了不浪费比较着急的朋友的的时间,先把解决方案说了,下面我在细说: 细说: 今天装了个xp的虚拟机,为了不在xp里重复装真机(win7的)里已经有的软件,就把我的工具盘共享给了虚拟机,大部分软件都可以 ...
- struts2封装客户端数据到Action
1.在Action中定义简单数据类型的属性 给Action定义简单类型的属性,封装客户端请求的数据 简单类型:String,基本类型和对应的引用类型 只要保证客户端请求的参数名称和Action的属性名 ...
- ASIHTTPRequest详解 [经典3]
大文件断点续传 0.94 以后支持大文件的断点下载,只需要设置: [ request setAllowResumeForFileDownloads:YES ]; [ request setDownlo ...
- VB.NET 注册表基本操作
''' <summary> ''' 注册表设置值 ''' </summary> ''' <param name="strKey"></pa ...