전체 글 (454) 썸네일형 리스트형 [Level 1][C++] 행렬의 덧셈 #include #include using namespace std;vector> solution(vector> arr1, vector> arr2) { vector> answer(arr1); for(int i=0; i [Level 1][C++] 가운데 글자 가져오기 #include #include using namespace std;string solution(string s) { string answer = ""; if(s.length()%2==0) answer += s.at(s.length()/2-1); // at 함수. 문자열 내 특정 위치에 있는 문자를 반환한다. answer += s.at(s.length()/2); return answer;} [Level 1][C++] 시저 암호 #include #include #include using namespace std;string solution(string s, int n) { char* arr = new char[s.length() + 1]; strcpy(arr, s.c_str()); for (int i = 0; i = 'A' && arr[i] 'Z') arr[i] -= ('Z'-'A'+1); arr[i] += n; } else { if (arr[i]+n > 'z') arr[i] -=.. 이전 1 ··· 14 15 16 17 18 19 20 ··· 152 다음