전체 글 (454) 썸네일형 리스트형 [Level 2][C++] 폰켓몬 #include #include using namespace std;int solution(vector nums){ set poketmons; for(int i=0; i=nums.size()/2) return nums.size()/2; else return poketmons.size();} [Level 2][C++] 카펫 #include #include using namespace std;vector solution(int brown, int red) { vector result; for (int col = 3; col [Level 2][C++] 최댓값과 최솟값 #include #include #include // streamstring의 헤더#include using namespace std;string solution(string s) { vector nums; stringstream ss(s); // 문자열을 stringstream에 집어넣음. string numString; while(ss>>numString) //공백 기준으로 쪼갠다. { nums.push_back(stoi(numString)); //문자열을 int로 변환해서 배열에 집어넣는다. } sort(nums.begin(), nums.end()); //오름차순으로 정렬 //int를 string으로 변환 strin.. 이전 1 ··· 3 4 5 6 7 8 9 ··· 152 다음