Computer Science, asked by akankshathakre, 2 months ago

given a set of points in a plane check weather the points lie on a straight line or not if the lie on straight line return the equation else return 0​

Answers

Answered by Faraazwgl
2

Answer:

good and nice

Explanation:

fsfmdmhhgh

Answered by shilpa85475
0

let’s say the sample input be :3

1 1 2 2 3 3 these are the lines on the plane i.e. (1,1), (2,2), (3,3) that lie on straight line

hence the output will be

1x-1y=0

Hence, we write the program as

n = int(input())

arr = [int(i) for i in input().split()][:n*2]

myeqn = {}

flag = 0

for i in arr:

  if i not in myeqn:

      myeqn[i] = 1

  else:

      myeqn[i] += 1

for i in myeqn:

  if myeqn[i] == 2:

      flag = 1

  else:

      flag = 0

      break

if flag:

  print('1x-1y=0')

else:

  print(0)

Similar questions