算法习题课第三章李承乾课稿.pptVIP

  • 2
  • 0
  • 约1.5万字
  • 约 93页
  • 2016-11-23 发布于湖北
  • 举报
int get_grid(grid grids[], int x,int y) { int n=0; for (int i=0; i8; i++) { int xx = x + direction[i][0] int yy = y + direction[i][1]; if (xx=0yy=0xxMyyN !visited[xx][yy]) { grids[n].x = xx; grids[n].y = yy; grids[n].count = get_count(xx, yy); n++; } } sort(grids,grids+n); return n; } bool operator (const grid a, const grid b) { return a.count b.count; } int get_count(int x, int y) { int i, xx, yy, count = 0; for (i=0; i8; i++) { xx = x + direction[i][0]; yy = y + direction[i][1]; if (xx=0yy=0xxMyyN!visited[xx][yy])

文档评论(0)

1亿VIP精品文档

相关文档