Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i will upvote provide solution in any language of your choice ONLY IN 10 MINUTESS IT SUPER URGENT any language of your choice any language
i will upvote provide solution in any language of your choice
ONLY IN 10 MINUTESS IT SUPER URGENT
any language of your choice any language of your choice but it should run with the output
Question system.out.println() may not work in case of syntax/runtime error. The version of Java 7 being used is 1.7.0_75. The city bus stations are located at equal distances (unit distance) from each other along a straight road. Each station has a unique station ID. The buses do not travel to all of the bus stations. The highway administration needs to determine the total distance that the buses cover. Given the IDs of the bus stations that have a bus operating between them, write an algorithm to help the administration find the distance covered by all the city buses. Input The first line of the input consists of two space-separated integers num and constM, representing the number of buses (N) and constM is always 2 . Next N lines consist of consrm space- Question Input The first line of the input consists of two space-separated integers num and constM, representing the number of buses (N) and constM is always 2. Next N lines consist of constM spaceseparated integers - busStop p0 and busstop representing the IDs of the bus stations that have a bus operating between them. Output Print an integer representing the distance covered by the buses. Constraints 0num1051busstop0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started