RACEL - EDITORIAL

Problem Link

Problem: https://www.codechef.com/problems/RACEL

CODE RUSH 1.0 Contest Link:https://www.codechef.com/CRSH2020

Author:Abhinav Deep
Tester: Krish Murarka
Editorialist: Krish Murarka

DIFFICULTY:

CAKEWALK

PREREQUISITES:

NO pre- Requisites for this question :grinning:

PROBLEM:

Rachel needs to play N rounds.In the k-th round Rachel will flip the face of all the coins whose number is less than or equal to k. That is, the face of the coin i will be reversed, from Head to Tail, or, from Tail to Head, for i ≤ k.
Rachel needs to guess the total number of coins showing a particular face after playing N rounds.

EXPLANATION:

if the initial face and the required face are the same, then the total count for the required face would be exactly half the number of times of the total rounds i.e. N/2.
And if the initial and required face is different, then the Total Number of required faces would become a Total number of rounds minus the number of times the same face appeared i.e. N-N/2.

Solutions

setters Solution

Testers Solution