当前位置:网站首页>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;
}
边栏推荐
- Flex --- detailed explanation of flex layout attributes
- LeetCode#268. Missing numbers
- C语言必背代码大全
- LeetCode#62. Different paths
- Market trend report, technical innovation and market forecast of lip care products in China and Indonesia
- JS --- all knowledge of JS objects and built-in objects (III)
- Market trend report, technical innovation and market forecast of Chinese hospital respiratory humidification equipment
- LeetCode#36. Effective Sudoku
- Perinatal Software Industry Research Report - market status analysis and development prospect forecast
- C语言是低级和高级的分水岭
猜你喜欢
csapp shell lab
Lab 8 file system
12306: mom, don't worry about me getting the ticket any more (1)
How to build a nail robot that can automatically reply
LeetCode#62. Different paths
STM32学习记录:玩转按键控制蜂鸣器和LED
STM32 learning record: play with keys to control buzzer and led
C语言学习笔记
Unpleasant error typeerror: cannot perform 'ROR_‘ with a dtyped [float64] array and scalar of type [bool]
C4D quick start tutorial - Introduction to software interface
随机推荐
China earth moving machinery market trend report, technical dynamic innovation and market forecast
Research Report on market supply and demand and strategy of geosynthetics industry in China
程序员的你,有哪些炫技的代码写法?
Cost accounting [22]
Alice and Bob (2021牛客暑期多校训练营1)
Word macro operation: convert the automatic number in the document into editable text type
C语言学习笔记
动态规划前路径问题
LeetCode#268. Missing numbers
FSM and I2C experiment report
Your wechat nickname may be betraying you
C语言数组的概念
JS --- BOM details of JS (V)
LeetCode#237. Delete nodes in the linked list
Brief introduction to libevent
Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
UCORE lab5 user process management experiment report
Learning records: serial communication and solutions to errors encountered
0-1背包問題(一)
LeetCode#198. raid homes and plunder houses