 # ACCURACY - EDITORIAL

Testers: gamegame
Editorialist: hrishik85

580

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)
``````
``````int x;cin>>x;
if (3-x%3==3) cout<<0<<endl;
else cout<<(3-x%3)<<endl;
``````
1 Like

hey could you please tell me why are we subtracting 3