New Math Problem (Level 1) : Number of cases Problem 2 OTSUMA-2014

Five parts in the figure below are painted by three colors of red, white, and yellow. 

How many ways of painting are there in all? 

Noted that any part should be painted in a different color from the next part.





Answer
30 ways


Solution
Five parts are assumed to be ① -⑤ as shown in the figure below. 

When ① is painted in red and ② is painted in white, the colors which are painted in ① ~ ⑤ would be as the following tree diagrams and there are five ways. 

Also when painting ① in red and ② in yellow, there are five ways and there are ten ways in total. 

There are are ten ways also when painting ① in white and yellow. 

Therefore, the painting ways are 10 × 3 = 30 ways in all.