C++ assignment (chess like)

So I got a task from our countries programming team to do this but I have no idea how I could go at it (I'm not looking for a solution in code but just how I could be able to do this in C++)

So you have a square chess field which is N x N fields big (get as input) and you have a rook placed on X1 and Y1 coords. You need to get it to X2 Y2 coords and calculate the cost of the cheapest way (if no way possible output is -1) with the costs of Cx (cost of moving 1 square in x-axis) and Cy (cost of moving 1 square in y-axis) then you get an input for M which is amount of obstacles. Followed by M lines of Xi Yi coords of the obstacles. You have to find the cheapest way from X1 Y1 to X2 Y2. The rook can only move left/right up/down and can't jump over obstacles.

Any help would be appreciated. The only problem I am having is how to count the obstacles in the equation.
Loks like pathfinding problem to me. I suggest looking into Dijkstra's algorithm.
Topic archived. No new replies allowed.