Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions