본문 바로가기
반응형

알고리즘288

[코드트리] 생명과학부 랩 인턴 (삼성 SW 역량테스트 2019 상반기 오전 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/biology-lab-intern 생명과학부 랩 인턴 문제 풀이는 BOJ 17143 : 낚시왕과 같다.#include #define MAX (100 + 20)int T;int R, C, M;typedef struct st{ int speed; int dir; int size;}MOLD;MOLD mold[MAX][MAX];/* 순서대로 1: 위, 2: 아래, 3: 오른쪽, 4: 왼쪽 */int dr[] = { 0, -1, 1, 0, 0 };int dc[] = { 0, 0, 0, 1, -1 };void input(){ scanf("%d %d.. 2024. 6. 8.
[코드트리] 시공의 돌풍 (삼성 SW 역량테스트 2019 상반기 오전 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/heros-of-storm 시공의 돌풍 문제 풀이는 BOJ 17144 : 미세먼지 안녕! 과 같다.#include #define MAX (50 + 10)int T;int R, C, time;int MAP[MAX][MAX];typedef struct st{ int r; int c;}RC;RC tornado[2];int tcnt;void input(){ scanf("%d %d %d", &R, &C, &time); tcnt = 0; for (int r = 1; r 0) { int cnt, dust; cnt = dust = 0;.. 2024. 6. 8.
[코드트리] 전투 로봇 (삼성 SW 역량테스트 2018 하반기 오후 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/fighting-robot 전투 로봇 문제 풀이는 BOJ 16236 : 아기 상어와 같다.#include #define MAX (20 + 10)int T;int N;int MAP[MAX][MAX];int visit[MAX][MAX];typedef struct st1{ int r; int c; int eat; int size;}ROBOT;ROBOT attackRobot;typedef struct st2{ int r; int c;}QUEUE;QUEUE queue[MAX * MAX];int wp, rp;int dr[] = { 0, -1, 0,.. 2024. 6. 8.
[코드트리] 바이러스 실험 (삼성 SW 역량테스트 2018 하반기 오후 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/virus-experiment 바이러스 실험 문제 풀이는 BOJ 16235 : 나무 재테크와 같다.#include #define MAX (10 + 5)int T;int N, M, K;int energy[MAX][MAX];int A[MAX][MAX];int virus[MAX][MAX][50000 + 50000];int front[MAX][MAX];int back[MAX][MAX];int dr[] = { -1, -1, -1, 0, 0, 1, 1, 1 };int dc[] = { -1, 0, 1, -1, 1, -1, 0, 1 };void inp.. 2024. 6. 8.
[코드트리] 토스트 계란틀 (삼성 SW 역량테스트 2018 하반기 오전 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/toast-eggmold 토스트 계란틀 문제 풀이는 BOJ 16234 : 인구 이동과 같다.#include #define MAX (100 + 20)#define abs(a) (((a) > 0) ? (a) : -(a))int T;int N, L, R;int A[MAX][MAX];typedef struct st{ int r; int c;}QUEUE;QUEUE queue[MAX * MAX];int wp, rp;void input(){ scanf("%d %d %d", &N, &L, &R); for (int r = 0; r rp) { QUEU.. 2024. 6. 8.
[코드트리] 병원 거리 최소화하기 (삼성 SW 역량테스트 2018 상반기 오후 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/min-of-hospital-distance 병원 거리 최소화하기 문제 풀이는 BOJ 15686 : 치킨 배달과 같다.#include #define MAX (50 + 10)int T;int N, M;int MAP[MAX][MAX];int hospitalList[MAX * 2];typedef struct st{ int r; int c;}RC;RC person[MAX * 2];RC hospital[13 + 5];int pcnt, hcnt;int minAnswer;int abs(int a, int b){ return (a > b) ? a - .. 2024. 6. 8.
[코드트리] 드래곤 커브 (삼성 SW 역량테스트 2018 상반기 오후 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/dragon-curve 드래곤 커브 문제 풀이는 BOJ 15685 : 드래곤 커브와 같다. (x, y 좌표가 반대)#include #define MAX (100 + 20)int T;int N, y, x, d, g;int MAP[MAX][MAX];int moveList[2000];int dx[] = { 0, -1, 0, 1 };int dy[] = { 1, 0, -1, 0 };void DFS(int L, int length){ if (L > g) return; for (int i = length + 1; i 2024. 6. 7.
[코드트리] 디버깅 (삼성 SW 역량테스트 2018 상반기 오전 2번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/debugging 디버깅 문제 풀이는 BOJ 15684 : 사다리 조작과 같다.#include int T;int N, M, H;int MAP[30 + 5][10 + 5];int PASS;void input(){ scanf("%d %d %d", &N, &M, &H); for (int r = 0; r 2024. 6. 7.
[코드트리] 이상한 체스 (삼성 SW 역량테스트 2018 상반기 오전 1번) 삼성 A형 전체 링크 Codetree 기출문제 링크 https://www.codetree.ai/training-field/frequent-problems/problems/odd-chess 이상한 체스 문제 풀이는 BOJ 15683 : 감시와 같다.#include #define MAX (10 + 2)int T;int N, M;int MAP[MAX][MAX];typedef struct st { int r; int c; int number;}CAMERA;CAMERA camera[8 + 2];CAMERA camera5[8 + 2];int cidx;int cidx5;int minAnswer;/* 순서대로 왼쪽, 위, 오른쪽, 아래 */int dr[] = { 0,-1,0,1 };int dc[] = { -1,0,1,.. 2024. 6. 7.
반응형