hi, any idea what's wrong with my code?
T = int(input()) 1<=T<=100 i = 1 while i<=T: count = 0 x = input() y = input() X = x.split() Y = y.split() N = int(X[0]) if i == 1: 1<=N<=100 else: 1<=N<=100000 B = int(X[1]) 1<=B<=100000 for p in range(0,N): P = int(Y[p]) 1<=P<=1000 if B>=P: B-=P count+=1 else: continue print('Case #',i,':',count) i+=1 On Monday, March 30, 2020 at 7:59:48 AM UTC+5:30, Jake Parratt wrote: > > 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 google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/6b909a27-35df-4970-9978-bd8e56531821o%40googlegroups.com.