c++

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 원하는 문자열 찾기

문제 코드 #include #include using namespace std; int solution(string myString, string pat) { int answer = 0; transform(myString.begin(), myString.end(), myString.begin(), ::tolower); transform(pat.begin(), pat.end(), pat.begin(), ::tolower); if (myString.find(pat) != string::npos) { return 1; } return answer; } https://modoocode.com/275 https://artist-developer.tistory.com/28 C++ transform std::tran..

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 길이에 따른 연산

문제 코드 #include #include using namespace std; int solution(vector num_list) { int answer = 0; if (num_list.size() >= 11) { for (int n : num_list) { answer += n; } } else if (num_list.size()

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 1로 만들기

문제 코드 #include #include #include using namespace std; int solution(vector num_list) { int answer = 0; for (int n : num_list) { int temp = n; while (temp != 1) { if (temp & 1) { temp = (temp - 1) / 2; } else { temp /= 2; } answer++; } } return answer; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 조건에 맞게 수열 반환하기 1

문제 코드 #include #include #include using namespace std; vector solution(vector arr) { vector answer; for (int n : arr) { if (n & 1 && n = 50) { answer.emplace_back(n * 0.5f); continue; } answer.emplace_back(n); } return answer; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 수열과 구간 쿼리 1

문제 코드 #include #include #include using namespace std; vector solution(vector arr, vector queries) { vector answer; for (vector query : queries) { for (int i = query[0]; i

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 n보다 커질 때까지 더하기

문제 코드 #include #include #include using namespace std; int solution(vector numbers, int n) { int answer = 0; int i = 0; for (i = 0; i < numbers.size(); ++i) { if (answer

mane
'c++' 태그의 글 목록 (11 Page)