'최소값' 태그의 글 목록
본문 바로가기
728x90
반응형

최소값3

1486 장훈이의 높은 선반 알고리즘 #include #include #include using namespace std; #define NS 21 int member[NS]; int N, B; int ret; int Min = 0x7fffffff; struct Seo { Seo() { int T; scanf("%d", &T); for (int t = 1; t = B) { if (Min > (sum - B))Min = (sum - B); } return; } dfs(sum + member[idx], idx + 1); dfs(sum, idx + 1); } }Seo; int main(void) { return 0; } 이문제의 포인트는 재귀로 넣고 빼고를 구현 할 수 있는지 입니다. 소스를 직접보면 어처구니 없이 너무나 쉬운데 이정도는 기본으로.. 2020. 2. 27.
[모의 SW 역량테스트] 홈 방범 서비스 #include #include #include using namespace std; #define NS 21 int kArr[NS * 2 - 1]; int input[NS][NS]; int N,M; int houseMax = 0x80000000; void houseSafe() { for (int ys = 0; ys < N; ys++) { for (int xs = 0; xs < N; xs++) { memset(kArr, 0, sizeof(kArr)); for (int ye = 0; ye < N; ye++) { for (int xe = 0; xe < N;xe++) { if (input[ye][xe] == 1) { int k = abs(ys - ye) + abs(xs - xe)+1; kArr[k]++; } .. 2019. 12. 1.
[모의 SW 역량테스트] 벽돌 깨기 #include #include #include #include #include using namespace std; #define NS 16 #define MS 13 int N, M, K; int ret; int nMin = 0x7fffffff; int input[NS][MS]; int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; void cntZero() {//벽돌개수 확인 함수 ret = 0;//ret 초기화 for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (input[i][j] != 0)ret++; } } } void copy(int cinput[NS][MS], int input[NS][MS]) .. 2019. 11. 28.
728x90
반응형