Created
April 15, 2012 14:12
-
-
Save jtwaleson/2393059 to your computer and use it in GitHub Desktop.
B - Dancing with the Googlers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rline(): | |
return stdin.readline().rstrip() | |
for i in range(int(rline())): | |
data = map(int, rline().split()) | |
googlers = data[0] | |
surprising = data[1] | |
p = data[2] | |
scores = data[3:] | |
num = 0 | |
for score in scores: | |
if score == 0 and p > 0: | |
pass | |
elif score >= 3*p - 2: | |
num += 1 | |
elif (score == 3*p - 3 or score == 3*p - 4) and surprising > 0: | |
surprising -= 1 | |
num += 1 | |
print "Case #%s: %s" % (i+1, num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment