-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10471.cpp
More file actions
44 lines (39 loc) · 703 Bytes
/
10471.cpp
File metadata and controls
44 lines (39 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 10471. 공간을 만들어 봅시다
// 2021.09.09
// 브루트 포스
#include<iostream>
#include<set>
#include<vector>
using namespace std;
int arr[101];
int main()
{
int w, p;
cin >> w >> p;
vector<int> v;
v.push_back(0);
v.push_back(w);
for (int i = 0; i < p; i++)
{
int k;
cin >> k;
v.push_back(k);
}
set<int> s;
for (int i = 0; i < v.size(); i++)
{
for (int j = 0; j < v.size(); j++)
{
if (v[i] - v[j] != 0)
{
s.insert(abs(v[i] - v[j]));
}
}
}
for (auto num : s)
{
cout << num << " ";
}
cout << endl;
return 0;
}