We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89b0181 commit 2d16b51Copy full SHA for 2d16b51
strange_addition.cpp
@@ -0,0 +1,48 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+int main()
4
+{
5
+ int k,x,y;
6
+ cin >> k;
7
+ set<int> s;
8
+ vector<int> v(k);
9
+ bool flag1 = false,flag2 = false;
10
+ for(int i=0;i<k;i++)
11
+ {
12
+ cin >> v[i];
13
+ }
14
+ sort(v.begin(),v.end());
15
16
17
+ x = v[i];
18
+ if(x == 0 || x == 100)
19
20
+ s.insert(x);
21
22
+ else if (x < 10 && !flag1)
23
24
+ s.insert(x) ;
25
+ flag1 = true;
26
27
+ else if (x % 10 == 0 && !flag2)
28
29
30
+ flag2 = true;
31
32
+ else
33
34
+ if(!flag1 && !flag2)
35
36
37
+ flag1=true;
38
+ flag2=true;
39
40
41
42
+ cout << s.size() << endl ;
43
+ for(auto it : s)
44
45
+ cout << it << " ";
46
47
+ return 0;
48
+}
0 commit comments