Back
Close
  • 5

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

The goal is to predict the position of two balls after stopping (at the beginning: one is moving, the other is immobile).
- The radius of the balls is 30.75mm
- We consider there is no borders.
- Any collision is perfectly elastic.
- The formula of the acceleration induced by the frictions is: a_d(t) = -0.8*v(t)
With v(t) the speed of the ball (in meters per second) and t the time (in seconds)
Input
Line 1: Two real numbers x0 and y0 (separated by a space), the position of the moving ball (in meters).
Line 2: Two real numbers x1 and y1 (separated by a space), the position of the static ball (in meters).
Line 3: Two real numbers vx and vy (separated by a space), the components of the velocity (in meters per second).
Output
Line 1: x0_f and y0_f (separated by a space), the components of the position of the moving ball when stopped rounded to two decimals (in meters).
Line 2: x1_f and y1_f (separated by a space), the components of the position of the static ball when stopped rounded to two decimals (in meters).
Constraints
Example
Input
1.24 0.34
0.29 1.05
0 0
Output
1.24 0.34
0.29 1.05

A higher resolution is required to access the IDE

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants