Last active
May 6, 2020 05:12
-
-
Save DongguemYoo/73bc3799f9029767b3783e340774d4fc to your computer and use it in GitHub Desktop.
코딩테스트 연습 (KAKAO) [1차] 비밀지도.cs (원래는 c++로 풀어야함)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//c#으로 한번 풀어봤음 | |
//검색 | |
//Convert.ToString(tmp, 2) 10진수를 2진수로 표현하는 방법 | |
public List<string> solution(int n,int[] arr1,int[] arr2) | |
{ | |
for (int i = 0; i < n; i++) | |
{ | |
int tmp = arr1[i] | arr2[i]; | |
test.Add(tmp); | |
char[] two = Convert.ToString(tmp, 2).ToCharArray(); | |
string map =""; | |
for (int x = 0; x < two.Length; x++) | |
{ | |
if (two[x] % 2 == 0) | |
map += " "; | |
else | |
map += "#"; | |
} | |
answer.Add(map); | |
} | |
return answer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment