And this one gives WA as well....WHY ?? This one is really making me mad....
def findSol(arr, budget):
arr.sort()
total = 0
count = 0
for i in range(0, len(arr)):
total += arr[i]
if total <= budget:
count += 1
else:
return count
def main():
t = int(input())
output = []
while t > 0:
num_and_budget = input().split()
num_and_budget = list(map(int, num_and_budget))
budget = num_and_budget[1]
items = input().split()
items = list(map(int, items))
output.append(findSol(items, budget))
t -= 1
for i in range(len(output)):
print("Case #" + str(i+1) + ": " + str(output[i]))
main()
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/2495566b-b639-4b88-8bec-ae16631ceedc%40googlegroups.com.