Following last year's event, we're doing Code Golf Advent Calendar 2022!
On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast or solving them in the shortest code. More details can be found in the link above.
I've got an infinite supply of two kinds of weirdly shaped chocolate:
- White chocolate, a square pyramid of side lengths 1
- Dark chocolate, a regular tetrahedon of side lengths 1
To celebrate the upcoming Christmas, I want to assemble them into a giant chocolate pyramid. When the base of the pyramid is a rectangle of size \$R \times C\$, the process to build such a pyramid is as follows:
- Fill the floor with \$RC\$ copies of White chocolate.
- Fill the gaps between White chocolate with Dark chocolate.
- Fill the holes between Dark chocolate with White chocolate. Now the top face is a rectangle of size \$(R-1) \times (C-1)\$.
- Repeat 1-3 until the top face has the area of 0.
The diagram below shows the process for \$2 \times 3\$. It takes 8 White and 7 Dark chocolate to complete the first floor, and 10 White and 8 Dark for the entire pyramid.
Given the width and height of the base rectangle, how many White and Dark chocolate do I need to form the chocolate pyramid?
You may assume the width and height are positive integers. You may output two numbers in any order.
Standard code-golf rules apply. The shortest code in bytes wins.
Test cases
(width, height) -> (white, dark)
(2, 3) -> (10, 8)
(10, 10) -> (670, 660)
(10, 1) -> (10, 9)