본문 바로가기
반응형

알고리즘288

[코드트리] 승자독식 모노폴리 (삼성 SW 역량테스트 2020 상반기 오후 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/odd-monopoly 승자독식 모노폴리 문제 풀이는 BOJ 19237 : 어른 상어와 같다.#include #define MAX (20 + 5)int T;int N, M, K;typedef struct st1{ int number; int current; int time;}INFO;INFO MAP[MAX][MAX];typedef struct st2{ int r; int c; int dir; int priority[5][5]; int dead;}PLAYER;PLAYER player[MAX * MAX];void input(){ scanf(.. 2024. 6. 8.
[코드트리] 술래잡기 체스 (삼성 SW 역량테스트 2020 상반기 오전 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/odd-chess2 술래잡기 체스 문제 풀이는 BOJ 19236 : 청소년 상어와 같다.#include int T;int MAP[6][6];typedef struct st2{ int r; int c; int dir; int dead;}CHESS;CHESS horse[17];int dr[] = { 0, -1, -1, 0, 1, 1, 1, 0, -1 };int dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 };int changeDir[] = { 0, 2, 3, 4, 5, 6, 7, 8, 1 };int maxAnswer;.. 2024. 6. 8.
[코드트리] 2차원 테트리스 (삼성 SW 역량테스트 2020 상반기 오전 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/tetris-2d 2차원 테트리스 문제 풀이는 BOJ 20061 : 모노미노도미노 2와 같다.#include #define START (4)#define END (9)int T;int N;int MAP[11][11];void output(){ for (int r = 0; r START; c--) for (int r = 0; r START; r--) for (int c = 0; c 2024. 6. 8.
[코드트리] 윷놀이 사기단 (삼성 SW 역량테스트 2019 하반기 오후 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/woodstick-fraud 윷놀이 사기단 문제 풀이는 BOJ 17825 : 주사위 윷놀이와 같다.#include int T;int dice[10 + 5];int next[32 + 5][6];int score[32 + 5];int board[32 + 5];int horse[5];int maxAnswer;void input(){ for (int i = 1; i 10) { if (maxAnswer 2024. 6. 8.
[코드트리] 이상한 다트 게임 (삼성 SW 역량테스트 2019 하반기 오후 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/odd-dart-game 이상한 다트 게임 문제 풀이는 BOJ 17822 : 원판 돌리기와 같다.단, 평균에 대한 처리가 다르다. (코드트리는 평균을 구할 때, 소숫점 아래의 수를 버린다.)void averageCircle(){ ... for (int r = 1; r avg) circle[r][c]--; } }} 전체 코드는 다음과 같다.#include #define MAX (50 + 5)int T;int N, M, Q;int circle[MAX][MAX];int X[MAX];int D[MAX];int K[MAX];typedef st.. 2024. 6. 8.
[코드트리] 이상한 윷놀이 (삼성 SW 역량테스트 2019 하반기 오전 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/odd-woodstick-game 이상한 윷놀이 문제 풀이는 BOJ 17837 : 새로운 게임 2와 같다.#include #define MAX (12 + 5)#define WHITE (0)#define RED (1)#define BLUE (2)int T;int N, K;int MAP[MAX][MAX];typedef struct st1{ int r; int c; int dir; int index;}HORSE;HORSE horse[12];int hcnt;int deque[MAX][MAX][50];// int front[MAX][MAX];in.. 2024. 6. 8.
[코드트리] 종전 (삼성 SW 역량테스트 2019 하반기 오전 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/war-finish 종전 문제 풀이는 BOJ 17779 : 게리맨더링 2와 같다.#include #define MAX (20 + 5)int T;int N;int MAP[MAX][MAX];int minAnswer;void input(){ scanf("%d", &N); for (int r = 0; r max) max = sum[i]; } if (max - min 2024. 6. 8.
[코드트리] 바이러스 백신 (삼성 SW 역량테스트 2019 상반기 오후 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/vaccine-for-virus 바이러스 백신 문제 풀이는 BOJ 17142 : 연구소 3과 같다.#include #define MAX (50 + 10)int T;int N, M;int MAP[MAX][MAX];int tmpMAP[MAX][MAX];typedef struct st{ int r; int c;}RC;RC queue[MAX*MAX];int wp, rp;RC virus[MAX*MAX];int vcnt;/* 순서대로 왼쪽, 위, 오른쪽, 아래 */int dr[] = { 0, -1, 0, 1 };int dc[] = { -1, 0, .. 2024. 6. 8.
[코드트리] 격자 숫자 놀이 (삼성 SW 역량테스트 2019 상반기 오후 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/matrix-number-play 격자 숫자 놀이 문제 풀이는 BOJ 17140 : 이차원 배열과 연산과 같다.#include #define MAX (100 + 20)int T;int R, C, K;int MAP[MAX][MAX];typedef struct st{ int number; int count;}NC;NC numberCount[MAX];int ncnt = 0;void input(){ scanf("%d %d %d", &R, &C, &K); for (int r = 0; r numberCount[k].count || ((num.. 2024. 6. 8.
반응형