Question: Barclays | Online Assessment | March 2023
3
Entering edit mode

Question 1

Tim, a seventh grade student, is introduced to the concept of lines in basic geometry class. He applies this
concept in real life. If he considers his house as one point and his friend Bill's house as another point, he can draw a line between these two points. Similarly, if the houses of all
his friends are considered as different points, he can draw multiple lines with his own house as the common point in each line. By taking his school as the reference, Tim marks the coordinates of
his N friends' houses. Write an algorithm to help Tim that takes the coordinates of his house (Xo,Yo)and his friends' houses (xi, yi)
and outputs the number of unique lines that can be drawn with Tim's house as the common point in each line.


Input


The first line of the input consists of two space-separated integers num and numCoordinate, represent the number of Tim's friends(N), number of coordinates in each of
the house position (M is always equal to 2), respectively. The next N lines consist of two
space separated integers.frndX and frndY representing the X and Y coordinates. of the houses of Tim's friends.
The next line consists of an integer - timX0, representing the X-coordinate of Tim's house.
The last line consists of an integer -timY0, representing the Y-coordinate of Tim's house.


Output


Print an integer representing the minimum number of Does that can be drawn.


Constraints


  num    105
-1000 < .frndX , frndY , timX0' ,timY0    1000
  i < num

numCoordinate = 2

Example 

Input

3 2
1 1
-1 1
2 3
0
0

Output:

3


Question 2

A space organization has N satellites in orbit. The satellites are assigned
IDs from 0 to N-1. A satellite can transfer data to any other satellite that lies within its bandwidth range.
A team at organization working on a project involving satellite communications, in this project, they wish to transfer data from the main
satellite with ID 0 to all the other satellites. But because the transfer data requires a enormous amount of power, a satellite can transfer data
to only one other at a time. Then, the satellite can connect to the server at organization which will help to connect this satelliteto other satellies near it
Only a fixed number of satellite can be in the bandwidth of range of a satellites at a time .The team wishes to determine the
minimum number of  iterations data transfer necessary to connect all the satellites

Write an algorithm to help the team to determine the minimum number of iterations of data transfer

 

Input


The first line of the input consists of two spaced separated intgers numSatellite (N) and constX,
representing the number of satel and mask is alavs?
The next No lines consist of
constkspace-separated integers
representng the satelle that can
transfer data and the satellite that
can receive the data respectively
The last line consists of an integer
manSateites recresenting the
mayimum number of satellites that
can be connected to one sateslite
SOMEONE

 

 

 

 

 

 

 

 

 

 

 

Login before adding your answer.

Similar Posts
Loading Similar Posts