Computer Science, asked by amilipoguvinay, 6 months ago

Consider there are n positive integers representing
total number of Trains running between Station RS[O]
and RS[d-1). RS is the array containing Railway
Stations in order of sequence of stations located one
after other. The d represents total number of
stations. RS[0] and RS[d-1] are the stations at both
ends.
There is another array T of size d which is equal to
the size of RS. T represents time in minutes between
last and current station. Array positions can be
mapped for RS and T in such a way that the train will
take time T[k] to reach station RS[k] from station
RS[K-1].
n trains start at RS [O] at different timestamps
represented by float value to indicate hour value
before precision point and minute value after
precision point. (11.30)
Values of RS and T are given as -
RS[O] = PANVEL T[0] = 0
RS[1] = KHANDESHWART [1] = 4
RS[2] = MANSAROVART [2] = 5
RS[3] = KHARGHART [3] = 3|
RS[4] = BELAPURT [4] = 4
RS[5] = SEAWOOD T [5] = 5
RS[6] = NERULT [6] = 3
Trains is set of values representing starting times (in
float for n number of trains running from Panvel to​

Answers

Answered by versac
3

Answer: code in python

Explanation:

RS=['PANVEL', 'KHANDESHWAR', 'MANSAROVAR', 'KHARGHAR', 'BELAR', 'SEAWOOD', ’NERUL']

T = [0.00, 0.04, 0.05, 0.03, 0.04, 0.05, 0.03]

Trains = [7.30, 8.2, 12.45, 13.30, 14.44, 15.50, 9.15, 10.20, 23.59, 17.33, 19.20]

time = float(input("Enter current time(hour.min)float"))

print(RS)

station=input("At which station you are right now?(Choose from above)").upper()

if station in RS:

station_number = RS.index(station)+1

else:

print("INVALID INPUT")

exit()

time_to_be_added = 0.0

for i in range(station_number):

time_to_be_added += T[i]

time += time_to_be_added

count=0

new_times = [x + round(time,2) for x in sorted(Trains)]

for i in new_times:

if i > round(time):

count+=1

print(count)

Similar questions