-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmissing_number.cpp
57 lines (48 loc) · 945 Bytes
/
missing_number.cpp
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
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mp make_pair
#define pb push_back
#define loop(x,n) for(int x = 0; x < n; x++)
#include <bits/stdc++.h>
#define RANGE 255
using namespace std;
long long int input(){
ll n;
cin>>n;
return n;
}
void solve(){
long long int n;
cin>>n;
long long int arr[n]={0};
arr[n]=0;
for(int i=1;i<=n-1;i++){
long long int h;
cin>>h;
arr[h]=1;
}
for(int j=1;j<=n;j++){
if(arr[n]==0){
cout<<n;
break;
}
if(arr[j]==0){
cout<<j;
}
}
}
int main() {
/*#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif*/
ios::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
solve();
cout<<"\n";}
}