twOBoOgEr

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Write a function P6:

  • There are two objects A, B on a line and a wall is placed at left. A is closer than B to the wall. Initially, A and B are static and each has 1 kg, nn kg. Suddenly, B moves toward A with speed 1 m/s and collides. The collision is elastic.
  • input parameter: a positive integer nn (n106n \le 10^6)
  • return value: the collision number between A and B or A and wall
  • Hint: When two objects with mass m_1m\_1 and m_2m\_2 collide with the initial velocity (not speed) v_1iv\_{1i} and v_2iv\_{2i}, the final velocity v_1fv\_{1f} and v_2fv\_{2f} satisfy the equation m_1v_1i+m_2v_2i=m_1v_1f+m_2v_2fm\_{1}v\_{1i} + m\_{2}v\_{2i} = m\_{1}v\_{1f} + m\_{2}v\_{2f}. And in elastic collision, the kinetic energy is conserved.