So I'm pretty new to python, but I can get this code to solve the problem
just
fine locally but I keep getting Runtime Errors. Can anyone see my problem?
If I comment out my print line it gives me a WA error instead and I've
tried to print
the answer in many different ways
results = []
test_cases = int(input())
counter = 0
while counter < test_cases:
counter += 1
totalHousesAndBudgetString = input()
totalHousesAndBudgetArray = totalHousesAndBudgetString.split()
totalHouses = int(totalHousesAndBudgetArray[0])
budget = int(totalHousesAndBudgetArray[1])
housing_cost_string = input()
housing_costs = housing_cost_string.split()
housing_costs.sort()
currentPrice = 0
index = 0
count = 0
while currentPrice < budget and count <= totalHouses:
currentPrice += int(housing_costs[index])
index += 1
if currentPrice <= budget:
count += 1
results.append(count)
aCounter = 1
for x in results:
print("Case #" + str(aCounter) + ": " + str(x))
aCounter += 1
--
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/353ee749-0ff3-423b-82f6-ba277b8a0234%40googlegroups.com.