Skip to content

Commit ae28a7a

Browse files
committed
Lv1_두개뽑아서더하기
1 parent 50a6f73 commit ae28a7a

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <string>
2+
#include <vector>
3+
#include <algorithm>
4+
using namespace std;
5+
6+
vector<int> solution(vector<int> numbers) {
7+
vector<int> answer;
8+
9+
for (int i = 0; i < numbers.size(); ++i) {
10+
for (int j = 0; j < numbers.size(); ++j) {
11+
if (i != j)
12+
answer.push_back(numbers[i]+numbers[j]);
13+
}
14+
}
15+
16+
sort(answer.begin(), answer.end());
17+
answer.erase(unique(answer.begin(), answer.end()), answer.end());
18+
return answer;
19+
}

Programmers/Programmers.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<ClCompile Include="Lv1\Lv1_내적.cpp">
4747
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
4848
</ClCompile>
49+
<ClCompile Include="Lv1\Lv1_두개뽑아서더하기.cpp" />
4950
<ClCompile Include="Lv1\Lv1_두정수사이의합.cpp">
5051
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
5152
</ClCompile>

Programmers/Programmers.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,5 +507,8 @@
507507
<ClCompile Include="Lv1\Lv1_3진법뒤집기.cpp">
508508
<Filter>소스 파일</Filter>
509509
</ClCompile>
510+
<ClCompile Include="Lv1\Lv1_두개뽑아서더하기.cpp">
511+
<Filter>소스 파일</Filter>
512+
</ClCompile>
510513
</ItemGroup>
511514
</Project>

0 commit comments

Comments
 (0)