当前位置:网站首页>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;
}
边栏推荐
- Research Report on market supply and demand and strategy of China's Medical Automation Industry
- 0-1 knapsack problem (I)
- China's earthwork tire market trend report, technical dynamic innovation and market forecast
- China medical check valve market trend report, technical dynamic innovation and market forecast
- Cost accounting [19]
- Do you know the advantages and disadvantages of several open source automated testing frameworks?
- Scoring system based on 485 bus
- Lab 8 文件系统
- LeetCode#412. Fizz Buzz
- 12306: mom, don't worry about me getting the ticket any more (1)
猜你喜欢
学习记录:使用STM32外部输入中断
洛谷P1102 A-B数对(二分,map,双指针)
LeetCode#237. Delete nodes in the linked list
Crawler series of learning while tapping (3): URL de duplication strategy and Implementation
动态规划前路径问题优化方式
UCORE LaB6 scheduler experiment report
ucore lab7
Learning record: understand systick system timer and write delay function
C4D quick start tutorial - Introduction to software interface
ucore Lab 1 系统软件启动过程
随机推荐
Accounting regulations and professional ethics [4]
LeetCode#2062. Count vowel substrings in strings
学习记录:串口通信和遇到的错误解决方法
China medical check valve market trend report, technical dynamic innovation and market forecast
ucore lab7
Learning record: use STM32 external input interrupt
ucore lab5
Flex --- detailed explanation of flex layout attributes
LeetCode#198. raid homes and plunder houses
12306: mom, don't worry about me getting the ticket any more (1)
How to change XML attribute - how to change XML attribute
C4D quick start tutorial - Introduction to software interface
TCP的三次握手与四次挥手
Hospital privacy screen Industry Research Report - market status analysis and development prospect forecast
STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)
力扣刷题记录--完全背包问题(一)
Cost accounting [13]
C语言是低级和高级的分水岭
Do you know the advantages and disadvantages of several open source automated testing frameworks?
Accounting regulations and professional ethics [1]