当前位置:网站首页>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;
}
边栏推荐
- Report on the market trend, technological innovation and market forecast of printing and decorative paper in China
- Jupyter installation and use tutorial
- C语言数组的概念
- Research Report on market supply and demand and strategy of Chinese graphic screen printing equipment industry
- STM32学习记录:玩转按键控制蜂鸣器和LED
- Perinatal Software Industry Research Report - market status analysis and development prospect forecast
- Eslint--- error: newline required at end of file but not found (EOL last) solution
- Printing quality inspection and verification system Industry Research Report - market status analysis and development prospect forecast
- Learning record: USART serial communication
- Es6--- two methods of capturing promise status as failed
猜你喜欢
差分(一维,二维,三维) 蓝桥杯三体攻击
JS --- detailed explanation of JS facing objects (VI)
Introduction to safety testing
ucore lab5
ucore lab 6
JS --- all knowledge of JS objects and built-in objects (III)
Want to change jobs? Do you know the seven skills you need to master in the interview software test
The most detailed postman interface test tutorial in the whole network. An article meets your needs
学习记录:理解 SysTick系统定时器,编写延时函数
STM32 learning record: input capture application
随机推荐
Market trend report, technical innovation and market forecast of lip care products in China and Indonesia
FSM和i2c实验报告
0-1背包问题(一)
Optimization method of path problem before dynamic planning
China's PCB connector market trend report, technological innovation and market forecast
C语言数组的概念
ucore lab 2
LeetCode#62. Different paths
LeetCode#36. Effective Sudoku
Market trend report, technical innovation and market forecast of Chinese hospital respiratory humidification equipment
Cost accounting [14]
Research Report on printed circuit board (PCB) connector industry - market status analysis and development prospect forecast
LeetCode#268. Missing numbers
Take you to use wxpy to create your own chat robot (plus wechat interface basic data visualization)
程序员的你,有哪些炫技的代码写法?
China's salt water membrane market trend report, technological innovation and market forecast
Jupyter installation and use tutorial
Introduction to safety testing
Hospital privacy screen Industry Research Report - market status analysis and development prospect forecast
[C language] twenty two steps to understand the function stack frame (pressing the stack, passing parameters, returning, bouncing the stack)