본문 바로가기

SW Expert Academy

(10)
[SWEA] 활주로 건설 SWEA 활주로 건설 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWIeW7FakkUDFAVH SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #include using namespace std; int n, l, ret = 0; int map[200][100]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; for (int tc = 1; tc > n >> l; for (int y =..
[SWEA] 줄기세포 배양 SWEA 줄기세포 배양 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWXRJ8EKe48DFAUo SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #include #include #include #include #include #define p pair using namespace std; // 동서남북 int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; int map[700][700]; int n, m, k; int ans; struct Node { int x; int..
[SWEA] 원자 소멸 시뮬레이션 SWEA 원자 소멸 시뮬레이션 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWXRFInKex8DFAUo SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #include #include using namespace std; struct Atom { int x; int y; int dir; int energy; }; int N; vector atoms; int map[4001][4001]; int dx[4] = { 0,0,-1,1 }; int dy[4] = { 1,-1,0,0 }; int calcTotalEn..
[SWEA] 미생물 격리 SWEA 미생물 격리 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV597vbqAH0DFAVl SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #include #include using namespace std; #define SIZE 1005//1005 int N, K, M; struct point { int x, y, num, dir; }; point micro[SIZE]; int x, y, nx, ny; int dx[] = { 0,-1,1,0,0 }; int dy[] = { 0,0,0,-1,1 }; ..
[SWEA] 점심 시간 SWEA 점심 시간 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5-BEE6AK0DFAVl& SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #include #include #include using namespace std; vector people; vector stair; int N; int board[10][10] = { 0, }; int mappingTable[10]; int answer; int peopleCnt; int getTime() { int t = 0; int chk = 0; int ..
[SWEA] 등산로 조성문제 SWEA 등산로 조성문제 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PoOKKAPIDFAUq SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; int t, n, k, res; int input[9][9]; bool visit[9][9]; void dfs(int x, int y, int cn..
[SWEA] 벌꿀 채취 SWEA 벌꿀 채취 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5V4A46AdIDFAWu #define _CRT_SECURE_NO_WARNINGS #include #include int input[10][10]; int n, m, c, res; int max(int a, int b) { return (a > b) ? a : b; } // (x,y) 좌표부터 m개의 꿀통을 선택해서 얻을 수 있는 최대 가격을 구하는 재귀 함수 void getMaxPrice(int x, int y, int cnt, int sum, int price) { if (sum > c) return; res = max(res,..
[SWEA] 수영장 SWEA 수영장 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PpFQaAQMDFAUq SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com #define _CRT_SECURE_NO_WARNINGS #include using namespace std; int price[4]; // 각 이용권 별 요금 int dayOfMonth[13]; // 이용 계획 int minMonth[13]; // 각 달을 이용하는 데 필요한 최소 이용 금액. int d[13]; int min(int a, int b) { return ..
[SWEA] 디저트 카페 SWEA 디저트 카페 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5VwAr6APYDFAWu // 브루트 포스 재귀 문제이다. // 일단 마름모 꼴로 시계 방향으로 움직이는 dx, dy 선언하고 // 각 점마다 solve 함수를 실행을 하는데 시작하는 점을 따로 기억을 해줘야함 // 그래야 solve 함수 내에서 종료조건에서 비교할 수있음 // solve 함수에서 원래 방향을 진행하는 경우와 1씩 증가시키는 경우로 재귀함수 진행해 주자 여기가 포인트임 #include #include using namespace std; int map[21][21] = { 0, }; bool check[101] =..
[SWEA] 보호필름 SWEA 보호필름 C++ 풀이 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5V1SYKAaUDFAWu // 브루트 포스 재귀 문제이다. // 치킨 배달 문제와 굉장히 비슷 하다. // 먼저 값을 받고 solve 함수에 (depth, cnt)로 놓고 함수 안에는 기저 조건으로 cnt가 ans보다 크게 되면 종료하게 되고 // depth가 D와 같아졌을때 검사를 한다. 일단 temp로 map과 같은 크기의 배열을 놓고 여기에 change를 통해 바뀐 값을 넣어 check()에서 확인을 한다. #include #include using namespace std; int map[14][21]; int temp[14]..