w****x 发帖数: 2483 | 1
这个不对吧, 怎么一横一竖跑两遍就完了呢?? 我贴一个超长版的:
int _inner_search_row(int A[M][N], int nIterRow, int nIterCol, int nTg);
int _inner_search_col(int A[M][N], int nIterRow, int nIterCol, int nTg);
bool FindTarget2(int A[M][N], int nTg)
{
int nIterRow = 0;
int nIterCol = N-1;
while (nIterCol >= 0 && nIterRow < M && A[nIterRow][nIterCol] != nTg)
{
nIterRow = _inner_search_row(A, nIterRow, nIterCol, nTg);
nIterCol = _inner_search_col(A, nIterRow, nIterCol, nTg);
}
return nIt... 阅读全帖 |
|