방속의 거울 문제(codeground)
/*★시뮬레이션 방법사용★ ★비슷 다른 문제★ 거울 2344, 2151거울2 2347빛의 왕과 거울의 미로1빛의 왕과 거울의 미로2금고회사*/ #include #include #include using namespace std;int dx[] = { 1, -1, 0, 0 };int dy[] = { 0, 0, 1, -1 };int a[1000][1000];bool c[1000][1000];// 0 = 아래, 1 = 위, 2 = 오른쪽, 3 = 왼쪽int change_dir(int dir, int mirror) {if (mirror == 1) { // 좌측 하단으로 45도 // 0 -> 3, 1 -> 2, 2 -> 1, 3 -> 0return 3 - dir;}else { // 우측 하단으로 45도 // 0 ..
프로그래밍/알고리즘
2016. 11. 26. 15:02