当前位置:网站首页>Ball Dropping
Ball Dropping
2022-07-06 09:25:00 【是小张张呀 zsy】
Ball Dropping
题目链接:https://ac.nowcoder.com/acm/contest/11166/B
来源:牛客网
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.
输入描述:
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 ‘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
示例1
输入
2 8 2 5
输出
Stuck
2.2206345966
示例2
输入
1 8 3 5
输出
Drop
很简单的签到题;
#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;
}
边栏推荐
- 0 - 1 problème de sac à dos (1)
- Cost accounting [19]
- Leetcode notes - dynamic planning -day6
- JS --- detailed explanation of JS DOM (IV)
- 学习记录:理解 SysTick系统定时器,编写延时函数
- HDU-6025-Coprime Sequence(女生赛)
- Accounting regulations and professional ethics [5]
- LeetCode#412. Fizz Buzz
- Report on the market trend, technological innovation and market forecast of printing and decorative paper in China
- D - Function(HDU - 6546)女生赛
猜你喜欢
Learning record: use stm32f1 watchdog
csapp shell lab
The most detailed postman interface test tutorial in the whole network. An article meets your needs
Es6---es6 content details
毕业才知道IT专业大学生毕业前必做的1010件事
Brief introduction to libevent
Learning record: STM32F103 clock system overview working principle
JS --- detailed explanation of JS facing objects (VI)
学习记录:TIM—基本定时器
C语言是低级和高级的分水岭
随机推荐
动态规划前路径问题优化方式
Cost accounting [14]
学习记录:TIM—电容按键检测
Lab 8 文件系统
Research Report on printed circuit board (PCB) connector industry - market status analysis and development prospect forecast
Market trend report, technological innovation and market forecast of pneumonia drugs obtained by Chinese hospitals
LeetCode#36. Effective Sudoku
Es6--- two methods of capturing promise status as failed
LeetCode#62. Different paths
Research Report on market supply and demand and strategy of China's land incineration plant industry
ucore lab5
ucore lab7
51 lines of code, self-made TX to MySQL software!
Want to change jobs? Do you know the seven skills you need to master in the interview software test
FSM和i2c实验报告
Flex --- detailed explanation of flex layout attributes
Research Report on market supply and demand and strategy of China's medical chair industry
Research Report on medical anesthesia machine industry - market status analysis and development prospect prediction
Brief introduction to libevent
China earth moving machinery market trend report, technical dynamic innovation and market forecast