Hello everyone, I am very new to these Google competitions and am confused
on how input works with Python 3. I did the Round A 2020 problem in
practice mode with the code below. However, it gets a runtime error, due to
it expecting the test to input the sample input line for line. How *should
*this
code look, or how does Google give its inputs?
"""
Kickstart Contest Question A: Allocation
Date: 4/12/2020
"""
def convertToInt(iterable):
for i in range(len(iterable)):
integer = int(iterable[i])
iterable[i] = integer
def main():
cases = int(input())
for case in range(cases):
temp = input().split()
convertToInt(temp)
convertToInt(temp)
houseNo = temp[0]
budget = temp[1]
housePrices = input().split()
convertToInt(housePrices)
housePrices.sort()
sum = 0
for i in range(len(housePrices)):
sum += int(housePrices[i])
if sum > budget:
i -= 1
break
print(f"Case #{case+1}: {i + 1}")
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/bf474e79-b21a-4f1b-a6c0-94bf439b1fff%40googlegroups.com.