Thursday, May 23, 2013

9935. Break the Chocolate

http://www.spoj.com/problems/BC/


from math import log, ceil
ct = input()
i = 1
while ct:
    ct -= 1
    a, b, c = map(int, raw_input().split())
    t = a * b * c
    x = ceil(log(a, 2)) + ceil(log(b, 2)) + ceil(log(c, 2))
    print "Case #%d: %d %d" % (i, t - 1, int(x))
    i += 1

1 comment:

  1. dont know what is wrong with people . Your code is useless to us untill it teaches me how u approached the solution. It would have been better had you explained your logic in simple english and how u came up with solutio. Afterall the main aim is not to submit the code but to learn so that we would be able to solve such problems ourselves in future.

    ReplyDelete