SRM 440 DIVII 250中文翻译及源码(C#)

Problem Statement(陈述)

You may remember an old computer game called "The Incredible Machine". It was a game where you could simulate simple processes like balls falling, lasers shooting, or cats pursuing mice. Moreover, you were able to perform these observations with different values for gravitational acceleration. Imagine a system with some unknown acceleration of gravity.

 

你可能还记得一个叫做不可思议的机器的古老电脑游戏。在这个游戏中,你可以模拟一些简单的过程,如小球下落,激光射击,或猫追老鼠。此外,你还能观测到不同的重力加速度。想象一下,这些不同的重力加速度对一个系统的影响吧。

 

There are N balls, each fixed initially at some height above the ground.You are given a int[] height, where the i-th element is the height of the i-th ball above the ground.

 

这里有为N个球,每个球都固定在一个给定初始值的高度上。给你一个整型数组(int[] height)来储存一组记录高度的数据,每个值及指代一个高度。

 

At time 0, the first ball is set loose and it starts falling. When it reaches the ground, the second ball is instantly set loose, and so on. This continues until the last ball reaches the ground at time T. Return the acceleration of gravity in this system.

 

松开第一个球,并开始计时,然后球开始自由下落。当它落到地面上时,第二个球立即开始下落,依次反复。直到在时间为T时,最后一个球落地为止。返回重力加速度的值。

 

Neglect air resistance and any other resisting factors. The distance d travelled by an object falling for time t with no initial velocity in a system with gravitational acceleration g and no resisting factors is equal to d = 0.5 * g * t^2.

 

忽略空气阻力和其他任何外界因素。物体在没有初速度且仅受重力加速度的作用下,经过时间t时走过的路程记为d,则有如下公式:d = 0.5 *g*t^ 2

 

 

Definition(定义)  

Class(类名): IncredibleMachineEasy

Method(方法): gravitationalAcceleration

Parameters(参数): int[], int

Returns(返回值类型): double

Method signature(方法定义样式): public double gravitationalAcceleration(int[] height, int T)

 

 

Notes(备注)

-          The returned value must have an absolute or relative error less than 1e-9.

-          返回值必须保证绝对或相对误差小于1e - 9

 

 

Constraints(限制)

-          height will contain between 1 and 50 elements, inclusive.

-          一组高度值限制在150个值之间 

-          Each element of height will be between 1 and 100, inclusive.

-          每个高度值限制在1100之间

-          T will be between 1 and 100, inclusive.

-          T限制在1100之间

 

 

Examples(样例)

0)     

{16,23,85,3,35,72,96,88,2,14,63}

30

Returns(返回值): 9.803799620759717

That's an acceleration of gravity that might be somewhere on Earth's surface.

这是地球某处的重力加速度的值。

 

1)     

{6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5}

12

Returns(返回值): 26.73924541044107

And this is likely on Jupiter.

这个值可能出现在木星上。

 

2)     

{8,8}

3

Returns(返回值): 7.111111111111111

That's a light one.

这是一个很小的值。

 

3)     

{3,1,3,1,3}

12

 Returns(返回值): 0.7192306901503684

You could nearly fly under such conditions.

在这个条件下,你几乎可以飞起来了。

 

 

Source code(源代码)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值