c++ vaulting problem

Vault question~! @#¥%……

There is a knight in Chinese chess on an n×m chessboard. It is stipulated that:

  1. The horse moves the day;
  2. The horse can only go to the right.
    The horse is required to go from the lower left corner (1, 1) of the chessboard to the upper right corner (n, m). Please write a program to output a feasible path.
    Input
    Enter two positive integers n and m, indicating that the size of the chessboard is n*m.
    Output
    Output a feasible path, represented by column and column subscripts, and connected with "->".
    Sample input 
    9 5
    Sample output 
    (1,1)->(3,2)->(5,1)->(6,3)->(7,1)->(8,3)-> (9,5)

answer

Idea: In-depth search (for some reasons, my results do not match the example, but the path shown by my program is also feasible) Also: My program has comments, you should be able to understand it; if you have any questions about my program If you don’t understand, feel free to ask me!

思路:深度搜索(因为某些原因,我的结果与样例不符,但我程序所显示的路径也是可行的)另:我的程序有注释,您应该能看明白;您如果对我的程序有不明白的,欢迎问我!

#include<iostream>
using namespa

Guess you like

Origin blog.csdn.net/aliyonghang/article/details/133530163