-
Notifications
You must be signed in to change notification settings - Fork 643
/
12.3.cpp
40 lines (34 loc) · 876 Bytes
/
12.3.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
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
// freopen("12.3.in", "w", stdout);
// int miss = 12345;
// for(int i=0; i<20000; ++i){
// if(i == miss) continue;
// cout<<i<<endl;
// }
// fclose(stdout);
freopen("12.3.in", "r", stdin);
int int_len = sizeof(int) * 8;
int bit_len = 0xFFFFFFFF / int_len;
int* bit = new int[bit_len];
int v;
while(scanf("%d", &v) != EOF){
bit[v/int_len] |= 1<<(v%int_len);
}
bool found = false;
for(int i=0; i<bit_len; ++i){
for(int j=0; j<int_len; ++j){
if((bit[i] & (1<<j)) == 0){
cout<<i*int_len + j<<endl;
found = true;
break;
}
}
if(found) break;
}
delete[] bit;
fclose(stdin);
return 0;
}