CHOCOCHEF - Editorial

PROBLEM LINK:

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

Author: notsoloud
Tester: tabr
Editorialist: iceknight1093

DIFFICULTY:

1104

PREREQUISITES:

None

PROBLEM:

Chef has N \geq 3 chocolates. Find a way to distribute them to three jars such that:

  • Each jar receives at least one chocolate
  • At least one jar has an odd number of chocolates
  • At least two jars have an equal number of chocolates.

EXPLANATION:

The smallest odd number is 1, so let’s put one chocolate into the first jar — this fulfills the odd condition.
To fulfill the equality condition, we can also put one chocolate into the second jar.
Now, simply put all remaining chocolates into the third jar and all the conditions are satisfied.

That is, print (1, 1, N-2)

TIME COMPLEXITY

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    n = int(input())
    print(1, 1, n-2)