Algorithm(CodeTree, C++)95 [코드트리] 문자열의 총 길이 구하기 C++ #include #include using namespace std;int main() { int n; cin >> n; string sentence; int len = 0, a_cnt = 0; for (int i = 0; i > sentence; int len_of_sentence = sentence.length(); len += len_of_sentence; if (sentence[0] == 'a') { a_cnt++; } } cout 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리.. 2024. 6. 8. [코드트리] 문자열의 총 길이 구하기 C++ #include #include using namespace std;int main() { string s; int length = 0; for (int i = 0; i > s; length += s.length(); } cout 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 8. [코드트리] 문자열 역순으로 출력하기 C++ #include #include using namespace std;int main() { string str_list[4]; for (int i = 0; i > str_list[i]; } for (int i = 3; i >= 0; i--) { cout 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 5. [코드트리] 문자열의 특정 위치 찾기 2 C++ #include #include using namespace std;int main() { // fruit_list string fruit_list[5] = {"apple", "banana", "grape", "blueberry", "orange"}; // input char alphabet; cin >> alphabet; int cnt = 0; for (int i = 0; i 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 5. [코드트리] 공백을 기준으로 출력 C++ #include #include using namespace std;int main() { // input string str1, str2; getline(cin, str1); getline(cin, str2); int str1_len = str1.length(); int str2_len = str2.length(); for (int i = 0; i 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 5. [코드트리] 문자 개수 세기 C++ #include #include using namespace std;int main() { string str; char s; getline(cin, str); cin >> s; int str_len = str.length(), cnt = 0; for (int i = 0; i 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 5. [코드트리] 문자열 범위 출력하기 C++ #include #include using namespace std;int main() { string str; getline(cin, str); for (int i = 2; i 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 5. [코드트리] 더 긴 문자열 C++ #include #include using namespace std;int main() { string str1, str2; cin >> str1 >> str2; int str1_len = str1.length(); int str2_len = str2.length(); if (str1_len > str2_len) { cout 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 3. [코드트리] 문자열의 길이 출력하기 C++ #include #include using namespace std;int main() { string str1, str2; cin >> str1 >> str2; cout 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 3. [코드트리] 공백없는 문자열 입력받아 출력하기 C++ #include #include using namespace std;int main() { string str; cin >> str; for (int i = 0; i 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 2024. 6. 2. [코드트리] 격자 모양 출력하기 C++ #include #include using namespace std;void set_square(int** square, int r, int c, int& curr_num){ square[r][c] = curr_num; curr_num++;} int main() { // input int n, m; cin >> n >> m; int** square = new int* [n]; for (int i = 0; i > r >> c; curr_num = r * c; r--; c--; // set_square set_square(square, r, c, curr_num); } // print for .. 2024. 6. 2. [코드트리] 격자에 점 그리기 C++ #include #include using namespace std;void set_square(int** square, int r, int c, int& curr_num) { square[r][c] = curr_num; curr_num++;}int main() { // input int n, m; cin >> n >> m; int** square = new int* [n]; for (int i = 0; i > r >> c; r--; c--; // set_square set_square(square, r, c, curr_num); } // print for (int i = 0; i 코드트리 | 코딩테.. 2024. 6. 2. [코드트리] 동전이 있는 위치 C++ #include #include using namespace std;void set_square(int** square, int r, int c) { square[r][c] = 1;}int main() { // input int n, m; cin >> n >> m; int** square = new int* [n]; for (int i = 0; i > r >> c; r--; c--; // set_square set_square(square, r, c); } // print for (int i = 0; i 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터.. 2024. 6. 2. [코드트리] 격자로 사각형 만들기 C++ 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai #include #include using namespace std;void fill_square(int** square, int n){ for (int i = 1; i > n; int** square = new int* [n]; for (int i = 0; i 2024. 6. 2. [코드트리] 파스칼의 삼각형 C++ #include #include using namespace std;void fill_triangle(int** triangle, int n) { for (int i = 2; i > n; int** triangle = new int* [n]; for (int i = 0; i 2) if (n > 2) { fill_triangle(triangle, n); } // print for (int i = 0; i = j) { cout 2024. 6. 1. [코드트리] 배열로 사각형 만들기 C++ #include #include using namespace std;int main() { int square[5][5]; for (int i = 0; i 2024. 6. 1. [코드트리] 격자 반대로 채우기 C++ #include #include using namespace std;#define NORTH 1#define SOUTH 0bool in_range(int x, int y, int n) { return 0 > n; int** square = new int* [n]; for (int i = 0; i 2024. 6. 1. [코드트리] 대각선으로 숫자 채우기 C++ #include bool in_range(int x, int y, int n, int m) { return (0 > n >> m; // 동적 할당 int **rect = new int *[n]; for (int i = 0; i 2024. 5. 29. 이전 1 2 3 4 5 6 다음