fork download
  1. #include <iostream>
  2.  
  3. const int width = 8;
  4. const int height = 8;
  5.  
  6. const bool maze[height][width] = {
  7. {0, 0, 0, 0, 0, 1, 1, 1},
  8. {0, 0, 1, 0, 0, 0, 0, 1},
  9. {0, 0, 0, 0, 0, 0, 0, 0},
  10. {0, 1, 0, 0, 0, 0, 0, 0},
  11. {0, 0, 0, 0, 1, 0, 0, 0},
  12. {0, 0, 0, 0, 0, 0, 0, 0},
  13. {1, 1, 0, 0, 0, 1, 0, 0},
  14. {1, 1, 0, 0, 0, 0, 0, 0},
  15. };
  16.  
  17. int main() {
  18. int row[width + 1] = {};
  19. row[width - 1] = 1;
  20.  
  21. for (int y = height - 1; y >= 0; y--) {
  22. for (int x = width - 1; x >= 0; x--) {
  23. row[x] = maze[y][x] ? 0 : row[x] + row[x + 1];
  24. }
  25. }
  26.  
  27. std::cout << row[0] << std::endl;
  28. }
Success #stdin #stdout 0s 4484KB
stdin
Standard input is empty
stdout
432