Mock CCC '23 Contest 1 J1 - Final Velocity

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 512M

Author:
Problem type

The first equation of motion states that \displaystyle v = u + a \times t where u is the initial velocity, v is the final velocity, a is the acceleration, and t is the time the object spends in motion.

You calculate the acceleration of a car and conclude that it has an acceleration of 3.

Given the initial velocity and the time the car spends accelerating, can you determine the final velocity of the car?

Input Specification

The input consists of two lines. The first line contains an integer u (0 \le u \le 30), representing the initial velocity. The second line contains an integer t (0 \le t \le 10), representing the time the car spends in motion.

Output Specification

Output the final velocity of the car.

Sample Input 1

10
3

Output for Sample Input 1

19

Explanation of Output for Sample Input 1

When the initial velocity is 10 and the time in motion is 3 seconds, we find that the final velocity is 10 + 3 \times 3 = 19.

Sample Input 2

10
4

Output for Sample Input 2

22

Explanation of Output for Sample Input 2

When the initial velocity is 10 and the time in motion is 4 seconds, we find that the final velocity is 10 + 3 \times 4 = 22.


Comments


  • 0
    lukegaming28282  commented on Dec. 13, 2024, 9:38 p.m.

    "10+3x4=22" I usually think that you solve it from left to right. BEDMAS is confusing even after you understand it.


  • 0
    s300047799  commented on Feb. 18, 2024, 8:47 p.m.

    Because the car has an acceleration of 3 so 3 seconds multiplied by 3 = 9 + 10 = 19


  • 0
    R_G  commented on Jan. 31, 2024, 12:18 a.m.

    why do you times everything by 3


  • 0
    TMcode  commented on Oct. 11, 2023, 1:05 a.m. edited

    For anyone submitting an answer written in C++ 20 in the future, I needed to add a blank line at the end. Not sure about other languages.