summaryrefslogtreecommitdiff
path: root/2010/1c/b/b.py
blob: ffe4d4193cf016a08dbba6a7b429bf95143b6ef6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
f = open('2.in', 'r')
o = open('2.out', 'w')

T = int(f.readline().strip())

for t in xrange(T):
    (l, p, c) = map(int, f.readline().strip().split(' '))
    
    res = 0
    if p / l != c:
        exp = 2
        res += 1
        while l * (c**exp) < p:
            exp *= 2
            res += 1
    
    s = "Case #%d: %s\n" % (t+1, res)
    print s
    o.write(s)