Hello, I’ve explained it Check my solution here: https://github.com/Thierrynjike/Kickstart-2020-round-a-allocation
On Mon, 30 Mar 2020 at 04:29, Jake Parratt <[email protected]> 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 [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 > <https://groups.google.com/d/msgid/google-code/353ee749-0ff3-423b-82f6-ba277b8a0234%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAFqGFGbud_%3DUV3n58S7P2cZeNt%2B-qBTB_xLtH6w1L40UPabH_g%40mail.gmail.com.
