LUCLO - Editorial

PROBLEM LINK:

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

Author: iceknight1093
Tester: pols_agyi_pols
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

Chef found N clovers, of which one of them was four-leaved and the rest were three-leaved.
How many leaves is that in total?

EXPLANATION:

The single four-leaf clover contributes 4 leaves.
There are N-1 remaining clovers, which are all three-leaved. So, their total number of leaves is
3\cdot (N-1).

The total number of leaves is thus

3\cdot (N-1) + 4

TIME COMPLEXITY:

\mathcal{O}(N) per testcase.

CODE:

Editorialist's code (Python)
n = int(input())
print(3*n + 1)