Sourakanti, it took me a few minutes to find what was wrong, and I had to run some testcases. Try testing your code a few ways with just one house.
Bartholomew On Tue, Mar 24, 2020 at 6:31 AM Sourakanti Mandal <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/google-code/2495566b-b639-4b88-8bec-ae16631ceedc%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/CAHaiWHMKkKJH8MdsYSDg1DoyfTv0hwWWj%3DLBhMmnWE6G45pKaQ%40mail.gmail.com.
