목록SW Expert Academy (9)
Study hard
[문제] swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14ABYKADACFAYh&categoryId=AV14ABYKADACFAYh&categoryType=CODE SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com [풀이] bfs를 사용하여 풀었다. 왼쪽 오른쪽 아래 순서로 다음 칸이 0이 아닌지 확인하고 0이라면 현재 칸에서의 탐색을 마쳤다. visited에 방문한 칸을 표시하여 왼쪽 또는 오른쪽으로 이동하다가 다시 반대방향으로 이동하는 것을 막았다. 왜 결과에 +1을 해야하는 지 잘 모르겠음.. #include #include #..
[문제] swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14geLqABQCFAYD&categoryId=AV14geLqABQCFAYD&categoryType=CODE SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com [풀이] bfs로 0부터 시작하여 99에 도달할 수 있는지를 구하였다. ※테스트케이스마다 길을 저장해 놓은 벡터 v를 clear해줘야 함! #include #include #include #include //memset using namespace std; int T, N; vectorv[100]; bool visited[..
[문제] swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV2b7Yf6ABcBBASw&categoryId=AV2b7Yf6ABcBBASw&categoryType=CODE SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com [풀이] dfs로 조합을 구하는 방법으로 풀었다. 합이 현재까지 구해둔 최소값보다 커지면 재귀를 하지 않고 넘어가는 식으로 시간을 줄였다. #include #include //min using namespace std; int T, N, B; int H[21]; bool check[21]; int Min; void dfs(..
[문제] swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5LtJYKDzsDFAXc&categoryId=AV5LtJYKDzsDFAXc&categoryType=CODE SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com [풀이] bfs로 시도했다가 제한 시간 초과가 떴다. dfs로 시도해보니 Pass할 수 있었다. 어차피 다음 방 번호가 현재 방 번호+1이어야 움직일 수 있다는 조건이 있으므로 중복되는 경로는 없다. visited배열 불필요. #include //#include using namespace std; /* struct Pos..
[문제] swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14vXUqAGMCFAYD&categoryId=AV14vXUqAGMCFAYD&categoryType=CODE SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com [풀이] bfs #include #include #include //memset #include //scanf using namespace std; struct Pos { int x, y; }; int Map[16][16]; bool visited[16][16]; const int dx[] = { -1,1,0,0 }; co..
[문제] swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV4yLUiKDUoDFAUx&categoryId=AV4yLUiKDUoDFAUx&categoryType=CODE SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com [풀이] bfs를 사용해서 풀었다. 각 명령어마다 수행할 일을 if문으로 구현했다. visited배열을 사용하여 같은 루트는 가지 않도록 했다. #include #include #include //memset using namespace std; struct Pos { int x, y; int d;//방향 int m;//메..