-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathalexnewmod.cpp
More file actions
54 lines (52 loc) · 974 Bytes
/
alexnewmod.cpp
File metadata and controls
54 lines (52 loc) · 974 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
//question link - https://www.codechef.com/KRSH2021/problems/ALEXMINE
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
int c=0;
for (int i = 0; i < n; i++)
{
c=0;
int temp = arr[i];
for (int j = 0; j < n; j++)
{
if(temp==arr[j])
c++;
}
if(c==1)
cout<<temp<<" ";
}
for (int i = 0; i < n; i++)
{
c=0;
int temp = arr[i];
for (int j = 0; j < n; j++)
{
if(temp==arr[j])
c++;
}
if(c==2)
cout<<temp<<" ";
}
for (int i = 0; i < n; i++)
{
c=0;
int temp = arr[i];
for (int j = 0; j < n; j++)
{
if(temp==arr[j])
c++;
}
if(c==3)
cout<<temp<<" ";
}
cout<<endl;
return 0;
}