Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

자이의 프로그래밍

Level 1. 비밀지도 본문

Algorithm/Cases-Programmers

Level 1. 비밀지도

Xi_kor 2020. 5. 11. 21:42

https://programmers.co.kr/learn/courses/30/lessons/17681

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

assign 함수의 사용에 대해 알았다!

#include <string>
#include <vector>

using namespace std;

vector<string> solution(int n, vector<int> arr1, vector<int> arr2) {
		
	vector<string> answer(n);
    
	for (int i = 0; i < n; i++) {
		int k = arr1[i] | arr2[i];
        
        answer[i].assign(" ",n);
		
        //뒤에서부터 채우기
		for (int j = n - 1; j >= 0; j--) {
			if (k % 2 == 0)
				answer[i][j] = ' ';
			else
				answer[i][j] = '#';
			k /= 2;
			
		}
	}
	return answer;
	
}