https://www.codechef.com/LRNDSA05/problems/BINXOR

please somebody please explain how to generate formula for this question also please provide tutorial if you could
thanks in advance;