I’d appreciate any help to solve this problem using c++.
We know the distances of all the settlements of CityA from CityB and CityC. I need a program that gives me which settlement is the farthest from Kukutyin.

INPUT:
The frst line of the standard input contains the count of settlements (1≤N≤100).
The next N lines contain the distances from CityB (1≤K≤300) and CityC (1≤P≤300) for each settlement, separated by a space.

OUTPUT:
The frst line of the standard output should contain the index of the settlement that is the farthest from CityB (if there is more than one solution, give the one with the smallest index).

Example
Input
6
42 15
110 20
125 160
166 180
42 100
110 39

Output
4

  • created

    Oct '21
  • last reply

    Oct '21
  • 1

    reply

  • 509

    views

  • 2

    users

  • 1

    link