当前位置:网站首页>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;
}
边栏推荐
- China's earthwork tire market trend report, technical dynamic innovation and market forecast
- Accounting regulations and professional ethics [3]
- Indonesian medical sensor Industry Research Report - market status analysis and development prospect forecast
- STM32 learning record: input capture application
- How to change XML attribute - how to change XML attribute
- Cost accounting [14]
- ucorelab4
- 差分(一维,二维,三维) 蓝桥杯三体攻击
- HDU - 6024 Building Shops(女生赛)
- Learning record: Tim - capacitive key detection
猜你喜欢

MATLAB实例:阶跃函数的两种表达方式

Leetcode notes - dynamic planning -day6

JS --- all knowledge of JS objects and built-in objects (III)

Visual analysis of data related to crawling cat's eye essays "sadness flows upstream into a river" | the most moving film of Guo Jingming's five years

Learning record: how to perform PWM output

ucore lab7

Lab 8 file system

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

JS --- detailed explanation of JS DOM (IV)
随机推荐
Jupyter installation and use tutorial
学习记录:使用STM32外部输入中断
How to change XML attribute - how to change XML attribute
Lab 8 file system
Eslint--- error: newline required at end of file but not found (EOL last) solution
How to build a nail robot that can automatically reply
Es6--- two methods of capturing promise status as failed
STM32学习记录:输入捕获应用
C语言学习笔记
动态规划前路径问题优化方式
Cost accounting [13]
Research Report on pharmaceutical R & D outsourcing service industry - market status analysis and development prospect forecast
ArrayList set
FSM and I2C experiment report
TCP的三次握手与四次挥手
Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
0-1 knapsack problem (I)
学习记录:STM32F103 时钟系统概述工作原理
Learning record: understand systick system timer and write delay function
学习记录:USART—串口通讯