PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4
Setter: lavish_adm
Testers: gamegame
Editorialist: hrishik85
DIFFICULTY:
580
PREREQUISITES:
None
PROBLEM:
There are 100 questions in the paper
- For each correct answer, Chef gets +3
- For each wrong answer, Chef get -1 (negative marking)
- For each unanswered question, Chef gets 0 points
What is the minimum number of problems Chef marked as incorrect given the score as N?
EXPLANATION:
Given a score N - For the minimum number of problems to be incorrect, the correct questions solved also need to be minimum.
The count of problems solved correctly will be (N / 3) rounded up to the nearest integer.
Score of problems solved correctly will be [{math.ceil (N/3)} * 3]
Problems solved incorrectly will be N - [{math.ceil (N/3)} * 3]
TIME COMPLEXITY:
Time complexity is O(1).
SOLUTION:
Editorialist's Solution
import math
t=int(input())
for _ in range(t):
n=int(input())
z=math.ceil(n/3)
print(3*z - n)