#include enum { EMPTY = '.', ROBOT = '@', WALL = '#', BOX = 'O', UP = '^', RIGHT = '>', DOWN = 'v', LEFT = '<', }; static char map[64][64]; // [y][x] static int w=0,h=0; // Map size static int move(int x, int y, int dx, int dy) { if (map[y+dy][x+dx] == BOX) { move(x+dx, y+dy, dx, dy); } if (map[y+dy][x+dx] != EMPTY) { return 0; } map[y+dy][x+dx] = map[y][x]; map[y][x] = EMPTY; return 1; } int main(void) { int x=0,y=0, dx,dy, direction, result; // Load map, set height and width while (fgets(map[h], sizeof map[0], stdin) && map[h][0] != '\n') h++; while (*map[++w]); // Find robot for (y=0; y