Back
Close

It's not rocket science

Statement

 Goal

A stationary rocket is launched and travels with a constant acceleration of 2 m/s² (meters per second squared).
This means that every second the rocket's speed increases by 2 meters per second.

The rocket reaches its goal in n seconds.

Print the distance traveled (in meters) by the rocket.
Input
n: an integer representing the duration of the rocket's flight (in seconds)
Output
d : the distance traveled by the rocket (in meters)
Constraints
0 < n < 10000
Example
Input
101
Output
10201

Game modes
Fastest, Shortest, Reverse

Test cases
Test 1 Test
Input
101
Output
10201

Validator 1 Validator
Input
4
Output
16

Test 2 Test
Input
1111
Output
1234321

Validator 2 Validator
Input
101
Output
10201

Test 3 Test
Input
264
Output
69696

Validator 3 Validator
Input
88
Output
7744

Test 4 Test
Input
22
Output
484

Validator 4 Validator
Input
77
Output
5929

Solution language

Solution

Stub generator input