There is a car with c litters of gas at the beginning, and the max capacity of gas the car can carry is n litters. There are m gas stations, each represented as 2 integers: p - the coordinate of that gas station, and x - the price of each litter of gas in that gas station.
The car starts at point 0, and needs to go to point d.
Assume that it takes 1 litter of gas per meter
What is the least amount of money to pay to get to point d?
I'm thinking of dynamic programming but don't know where to start.