CLEARANCE - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: iceknight1093
Tester: nskybytskyi
Editorialist: iceknight1093

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Chef gets one extra t-shirt for every 2 he buys.
If he buys X t-shirts (X is even), how many t-shirts does he have in total?

EXPLANATION:

Every 2 out of the X t-shirts will give one extra.
So, Chef will receive \frac{X}{2} free t-shirts.

The total number of t-shirts is thus

X + \frac{X}{2}

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Author's code (python)
x = int(input())
print(x + x/2)