kphmd's blog

By kphmd, 12 years ago, In English


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.

  • Vote: I like it
  • +9
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Despite I solve this problem, I can't understand your "tips", except formula.

  • »
    »
    12 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    if a==1 or b==1 or c==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)

»
12 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

nice idea for finding this formula ;)

but i couldn't understand your numbers above each sample, can you explain more ?

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Here's my solution :D

cout << (b * c) + (a - 1) * (b + c - 1);
»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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)