Problem link: REMOVEMUL Problem - CodeChef
This code is correct(PYTHON 3):
for t in range(int(input())):
n,m = map(int,input().split())
q = list(map(int,input().split()))
sumtilln=n*(n+1)//2
print(int(sumtilln-sum(q)))
This code is wrong(removed “/” on line 4):
for t in range(int(input())):
n,m = map(int,input().split())
q = list(map(int,input().split()))
sumtilln=n*(n+1)/2
print(int(sumtilln-sum(q)))
This is the testcase it is failing on:
WHY ARE USE USING “//” instead of “/”?
“//” is used for floor division while"/" is used for normal division, why aren’t we dividing normally when it will always be perfectly divisible.