公式

A - Pairing 解説 by en_translator


There are many approaches to this problem. Here we will introduce one that does not bother so much.

For each \(i=1,2,3,4\), count how many balls of color \(i\) are there. This can be done with an array and a for loop.

If there are two or three balls of the same color, then one operations can be performed; if there are four, then two operations can be preformed. The answer can be obtained by summing them up for all \(i\).

投稿日時:
最終更新: