题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83008#problem/E
Description
HINT
题意:
给你一个水池,水池中放一个东西,上面一双眼睛,问眼睛能看到东西时,水面的最小高度
题解:
列列方程就是了
1 #include <cstdio> 2 #include <cmath> 3 #include <cstring> 4 #include <ctime> 5 #include <iostream> 6 #include <algorithm> 7 #include <set> 8 #include <vector> 9 #include <sstream> 10 #include <queue> 11 #include <typeinfo> 12 #include <fstream> 13 #include <map> 14 #include <stack> 15 typedef long long ll; 16 using namespace std; 17 //freopen("D.in","r",stdin); 18 //freopen("D.out","w",stdout); 19 #define sspeed ios_base::sync_with_stdio(0);cin.tie(0) 20 #define test freopen("test.txt","r",stdin) 21 #define maxn 2000001 22 #define mod 1000000007 23 #define eps 1e-9 24 const int inf=0x3f3f3f3f; 25 const ll infll = 0x3f3f3f3f3f3f3f3fLL; 26 inline ll read() 27 { 28 ll x=0,f=1;char ch=getchar(); 29 while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 30 while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 31 return x*f; 32 } 33 //************************************************************************************** 34 35 double w,h,x,xe,ye,p; 36 37 int main() 38 { 39 int t=read(); 40 while(t--) 41 { 42 cin>>w>>h>>x>>xe>>ye>>p; 43 double tan1=(xe-w)/(ye-h); 44 double tan2=tan(asin(sin(atan(tan1))/p)); 45 46 double x1=w-tan1*h; 47 double ans=(x-x1)/(tan1-tan2); 48 if(ans<=0) 49 cout<<"0.0000"<<endl; 50 else if(ans>h) 51 cout<<"Impossible"<<endl; 52 else 53 printf("%.4f ",ans); 54 } 55 }