INLO22 - Editorial

PROBLEM LINK:

Practice
Contest

Author: RAVIT SINGH MALIK
Editorialist: RAVIT SINGH MALIK

DIFFICULTY:

EASY

PREREQUISITES:

LOGIC,Implementation

PROBLEM:

Find the number of cubies in a cube that has exactly two colors in a n \times m \times o rubis’s cube.

EXPLANATION:

As we all know in 3 \times 3 \times 3 cube 6 cubies have only one color and they are present at the center of each
face. 8 cubies have exactly three color and they are present only at the corners.
and the cubies that have exactly two color which are present at each edge, and it is 12.

In a generalise manner for the cubies which have exactly 2 color are present only at edges.
so,if a edge has length of 5 unit then it has (5-2) cubies have exactly 2 color, and there are 4 edges with
5 unit so,(5-2) \times 4.
In a cube we have 3 length, 3 breagth , 3 height, so, if a cube has length 5 ,breagth 6 ,height 7 ,

a=(5-2)\times4;

b=(6-2)\times4;

c=(7-2)\times4;

ans=a+b+c;

but,

if(ans<=0)

ans=0;

AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

RELATED PROBLEMS: