File tree Expand file tree Collapse file tree 1 file changed +31
-32
lines changed Expand file tree Collapse file tree 1 file changed +31
-32
lines changed Original file line number Diff line number Diff line change 1
1
//Solved by Kalai Arasi, Dept of CSE
2
2
3
- #include <stdio.h>
4
- main ()
5
- {
6
- int a [10 ],b [10 ];
7
- int number ,i ,j ;
8
- a [0 ]= 0 ;
9
- a [1 ]= 1 ;
10
- a [2 ]= 2 ;
11
- a [3 ]= 3 ;
12
- a [4 ]= 4 ;
13
- a [5 ]= 4 ;
14
- a [6 ]= 6 ;
15
- a [7 ]= 7 ;
16
- a [8 ]= 8 ;
17
- a [9 ]= 9 ;
18
- for (i = 0 ;i < 10 ;i ++ )
19
- b [i ]= 0 ;
20
- for (i = 0 ;i < 10 ;i ++ )
21
- {
22
- number = i ;
23
- for (j = 0 ;j < 10 ;j ++ )
24
- {
25
- if (a [j ]== number )
26
- {
27
- b [i ]= 1 ;
28
- continue ;
29
- }
30
- }
31
- }
32
- for (i = 0 ;i < 10 ;i ++ )
33
- if (b [i ]== 0 )
34
- printf ( "%d\n" ,i );
3
+ #include <iostream>
4
+ #include <stdlib.h>
5
+ using namespace std ;
6
+
7
+ int main () {
8
+ int * a ;
9
+ int * flag ;
10
+ int n ,i ;
11
+ cin >>n ;
12
+ a = new int [n ];
13
+ flag = new int [n ];
14
+ for (i = 1 ;i <=n ;i ++ )
15
+ {
16
+ cin >>a [i ];
17
+ }
18
+ for (i = 1 ;i <=n ;i ++ )
19
+ {
20
+ flag [i ]= 0 ;
21
+ }
22
+ for (i = 1 ;i <=n ;i ++ )
23
+ {
24
+ flag [a [i ]]= 1 ;
25
+ }
26
+ for (i = 1 ;i <=n ;i ++ )
27
+ {
28
+ if (flag [i ]== 0 )
29
+ {
30
+ cout <<i <<"\n" ;
31
+ }
32
+ }
33
+ return 0 ;
35
34
}
You can’t perform that action at this time.
0 commit comments