반응형
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int solution(vector<int> numbers) {
int answer = 0;
int i=0;
int num=0;
sort(numbers.begin(),numbers.end());
while(num<10){
if(numbers[i]==num){
i++;
}
else{
answer+=num;
}
num++;
}
return answer;
}
반응형
'컴퓨터공학' 카테고리의 다른 글
[프로그래머스, C++] 자릿수 더하기 (0) | 2021.09.26 |
---|---|
[프로그래머스, C++] 예산 (0) | 2021.09.26 |
[프로그래머스, C++] 수박수박수박수박수박수? (0) | 2021.09.19 |
[프로그래머스/ C++]두 정수 사이의 합 (0) | 2021.09.19 |
[프로그래머스/C++] 약수의 개수와 덧셈 (0) | 2021.09.19 |