#include <iostream>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
int main()
{
const int len=10000000;
//const int len=10000;
cout<<"耗内存约:"<<
len/8.0 //byte
/1024.0 //kb
/1024.0 //mb
<<"mb"
<<endl;
srand( time(NULL) );
bitset<len> bt;
//cout<<bt<<endl;
for(int i=0;i<15;++i){
int rnd=rand()%len ;
cout<<rnd<<",";
bt.set(rnd);
}
cout<<endl;
//output idx is 1
for(int i=0;i<len;++i){
if(bt.test(i)) cout<<i<<endl;
}
cout<<endl;
//cout<<bt<<endl;
//cout<<"rand_max:"<<RAND_MAX<<",2^16:"<<pow(2,15)<<endl;
//bitset<64> bt64(32);
//cout<<bt64<<endl;
getchar();
return 0;
}