BLACKCEL - Editorial

PROBLEM LINK:

Contest - Division 3
Contest - Division 2
Contest - Division 1

DIFFICULTY:

CAKEWALK

PROBLEM:

Find the number of black cells in a n*n chessboard (where n is even).

EXPLANATION:

Since n is even, and each row of the board has an alternating sequence of colours, the number of black cells in each row is exactly \frac{n}{2} (What would happen if n wasn’t even?). Therefore, the number of black cells over all n rows is n*\frac{n}{2}.

TIME COMPLEXITY:

For each test case, computing the answer takes O(1) time.

SOLUTIONS:

Editorialist’s solution can be found here.


Experimental: For evaluation purposes, please rate the editorial (1 being poor and 5 excellent)

  • 1
  • 2
  • 3
  • 4
  • 5

0 voters