Company: Wells_Fargo
Difficulty: medium
Bus Fare Minimization Problem Problem Description In a city, a bus stops every kilometer. Also, the bus fare is different from 1km to 10km, so you can use each section well to decrease the total fare to get to destination. For example, let's suppose a bus fare list as below: 12 21 31 40 49 58 69 79 90 101. According to the list, the minimum fare would be 147 for 15km: → 1 ticket for 3km + 2 tickets for 6km. When the bus fare and distance are given, calculate the minimum fare that you can move to given distance. Input: First line: 10 integers, the bus fare from 1km to 10km. Second line: The distance to move, N. Output: The minimum fare to travel the distance. Examples Example 1: Input: 12 21 31 40 49 58 69 79 90 101 15 Output: 147 Constraints 1 ≤ N ≤ 10000