当前位置:网站首页>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;
}
边栏推荐
- 【练习-7】Crossword Answers
- Market trend report, technical innovation and market forecast of geosynthetic clay liner in China
- Cost accounting [18]
- socket通讯
- X-forwarded-for details, how to get the client IP
- 数据在内存中的存储&载入内存,让程序运行起来
- [exercise-7] crossover answers
- Cost accounting [14]
- TCP的三次握手与四次挥手
- Research Report of cylindrical grinder industry - market status analysis and development prospect forecast
猜你喜欢
渗透测试 ( 2 ) --- 渗透测试系统、靶机、GoogleHacking、kali工具
STM32 how to use stlink download program: light LED running light (Library version)
D - Function(HDU - 6546)女生赛
渗透测试 ( 5 ) --- 扫描之王 nmap、渗透测试工具实战技巧合集
C语言必背代码大全
Information security - threat detection - detailed design of NAT log access threat detection platform
Penetration test (1) -- necessary tools, navigation
X-Forwarded-For详解、如何获取到客户端IP
信息安全-安全编排自动化与响应 (SOAR) 技术解析
b站 實時彈幕和曆史彈幕 Protobuf 格式解析
随机推荐
CS zero foundation introductory learning record
STM32 how to use stlink download program: light LED running light (Library version)
Flink 使用之 CEP
初入Redis
Cost accounting [24]
Gartner: five suggestions on best practices for zero trust network access
【练习-11】4 Values whose Sum is 0(和为0的4个值)
树莓派CSI/USB摄像头使用mjpg实现网页摄像头监控
China exterior wall cladding (EWC) market trend report, technical dynamic innovation and market forecast
TCP的三次握手与四次挥手
The most complete programming language online API document
7-1 懂的都懂 (20 分)
Penetration test (2) -- penetration test system, target, GoogleHacking, Kali tool
信息安全-史诗级漏洞Log4j的漏洞机理和防范措施
Analyse du format protobuf du rideau en temps réel et du rideau historique de la station B
渗透测试 ( 3 ) --- Metasploit Framework ( MSF )
Cost accounting [14]
信息安全-威胁检测引擎-常见规则引擎底座性能比较
VS2019初步使用
X-forwarded-for details, how to get the client IP