but i can’t find out what’s wrong in my solution can anyone please explain
here is my solution link : CodeChef: Practical coding for everyone
and the solution is :
n,m,k = map(int,input().split())
certified =0
total_min =0
for i in range(n):
lis = list(map(int,input().split()))
if lis[-1]<=10:
for i in range(0,k-1):
total_min+= lis[i]
if total_min>=m:
certified+=1
print(certified)
It should have been
for i in range(0,k):
instead. Try putting this.
I tried that is also giving wrong ans here is the link : CodeChef: Practical coding for everyone
and code:
n,m,k = map(int,input().split())
certified =0
for i in range(n):
total_min =0
lis = list(map(int,input().split()))
if lis[-1]<=10:
for i in range(0,k):
total_min+= lis[i]
print(total_min)
if total_min>=m:
certified+=1
print(certified)
Why are you printing total_min? Remove that, it should give AC
try this:
n,m,k = list(map(int,input().split()))
certified = 0
for _ in range(n):
lis = list(map(int,input().split()))
q = lis[-1]
lis.remove(q)
sum_lis = sum(lis)
if (sum_lis >=m) and (q<=10):
certified+=1
print (certified)
code link → CodeChef: Practical coding for everyone