当前位置:网站首页>Ball Dropping
Ball Dropping
2022-07-06 16:02:00 【It's Xiao Zhang, ZSY】
Ball Dropping
Topic link :https://ac.nowcoder.com/acm/contest/11166/B
source : Cattle from
A standard sphere ball is falling in the air, and the center of the sphere is exactly on the centerline of an empty isosceles trapezoidal. The trapezoid is hanging horizontally under the sphere.
Please determine whether the ball will get stuck in the trapezoid or drop past the trapezoid.
Input description :
The input contains four integers r,a,b,h(1≤r,a,b,h≤1000,a>b), indicating the radius of the ball, the top base, the bottom base, and the height of the isosceles trapezoid.
It is guaranteed that 2r !=b,2r<a,2r<h.
Output description :
Output ‘Drop’ if the sphere ball will drop past the empty trapezoid, otherwise output ‘Stuck’.
If the answer is ‘Stuck’, please also calculate the stuck position(the height between the center of the sphere and the midpoint of the bottom base). Your answer is considered correct if its absolute or relative error does not exceed 10^−6
Example 1
Input
2 8 2 5
Output
Stuck
2.2206345966
Example 2
Input
1 8 3 5
Output
Drop
Very simple sign in question ;
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
double n,m,u,v,b,a,ma=-1,r,h;
int main()
{
cin>>r>>a>>b>>h;
if(r*2<b)
cout<<"Drop";
else{
cout<<"Stuck"<<endl;
double u;
u=(2.0*r*sqrt(h*h+(a-b)*(a-b)*1.0/4)-b*h)*1.0/(a-b);
printf("%.10f",u);
}
return 0;
}
边栏推荐
- CEP used by Flink
- Shell Scripting
- 【练习-11】4 Values whose Sum is 0(和为0的4个值)
- China earth moving machinery market trend report, technical dynamic innovation and market forecast
- Analyse du format protobuf du rideau en temps réel et du rideau historique de la station B
- 渗透测试 ( 3 ) --- Metasploit Framework ( MSF )
- Opencv learning log 31 -- background difference
- Opencv learning log 33 Gaussian mean filtering
- Research Report on market supply and demand and strategy of Chinese graphic screen printing equipment industry
- Opencv learning log 15 count the number of solder joints and output
猜你喜欢
随机推荐
[exercise-7] (UVA 10976) fractions again?! (fraction split)
[exercise -10] unread messages
Essai de pénétration (1) - - outils nécessaires, navigation
1010 things that college students majoring in it must do before graduation
[exercise-2] (UVA 712) s-trees
Opencv learning log 14 - count the number of coins in the picture (regardless of overlap)
Cost accounting [22]
[exercise-9] Zombie's Treasury test
Shell脚本编程
Optimization method of path problem before dynamic planning
China potato slicer market trend report, technical dynamic innovation and market forecast
快速转 TypeScript 指南
【练习-6】(PTA)分而治之
Record of force deduction and question brushing
【练习-1】(Uva 673) Parentheses Balance/平衡的括号 (栈stack)
CS zero foundation introductory learning record
0-1背包問題(一)
[exercise-8] (UVA 246) 10-20-30== simulation
Record of brushing questions with force deduction -- complete knapsack problem (I)
渗透测试 ( 8 ) --- Burp Suite Pro 官方文档