some tips about problem A
a=2 b=3 c=4 total=18
O O O O
O O O O O
O O O O O
O O O O
`a=1` b=4 c=5 total=20 0:2 O:18
O O O O 0
O O O O O
O O O O O
0 O O O O
a=4 `b=1` c=6 total=24 0:6 O:18
0 0 O O O O
0 O O O O O
O O O O O 0
O O O O 0 0
a=5 b=6 `c=1` total=30 0:12 O:18
0
0 0
0 0 0
O O O O
O O O O O
O O O O O
O O O O
0 0 0
0 0
0
cout << (a+c-1)*(b+c-1)-c*(c-1) << endl;
You can see this submission 2013799.
Despite I solve this problem, I can't understand your "tips", except formula.
if
a==1
orb==1
orc==1
then this problem answer is b*c or c*a or a*b.See the last 3 picture of my blog, you can find a=1,b=1 and c=1.
For get real answer, need sub the
0
in picture.(b+a-1)*(c+a-1)-a*(a-1)
(c+b-1)*(a+b-1)-b*(b-1)
(a+c-1)*(b+c-1)-c*(c-1)
nice idea for finding this formula ;)
but i couldn't understand your numbers above each sample, can you explain more ?
Here's my solution :D
I think it is possible to solve this problem in a simpler way. Just imagine that the picture is a 3D figure with planes ab ac and bc and you need to find its visible surface area. The solution would be a*b+a*c+b*c; however, you still need to reduce the number of hexagons that are counted twice. Hence, the final solution is: b*c+(a-1)*c+(b-1)*(a-1)