-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp.cpp
More file actions
58 lines (50 loc) · 938 Bytes
/
p.cpp
File metadata and controls
58 lines (50 loc) · 938 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>
using namespace std;
void file()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
// freopen("error.txt","w",stderr);
#endif
}
int solve(){
int a; cin >> a;
int arr[a];
for(int t=0; t<a; t++){
cin>>arr[t];
}
for(int i=0; i<a; i++){
bool isValid = false;
for(int j=0; j<i; j++){
if(arr[i] == arr[j]){
isValid = true;
break;
}
}
if(!isValid) {
cout << arr[i] << " ";
}
}
}
int data(){
for(int i=0; i<5; i++){
cout << i << " ";
for(int j=0; j<i; j++){
cout << j << "* ";
}
cout << endl;
}
}
int main()
{
//[1,2,2,4,1,3,2]
file();
solve();
// int n;
// cin >> n;
// while (n--)
// {
// solve();
// }
}