程式碼示例:
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<map>
#include<ctime>
using namespace std;
map<int,int > Hash;
int main()
{
int x=time(0);
for(int i=1;i<=10000000;i++)
Hash[i]=i;
}
cout<<(time(0)-x)<<endl;
x=time(0);
Hash[i];
程式碼示例:
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<map>
#include<ctime>
using namespace std;
map<int,int > Hash;
int main()
{
int x=time(0);
for(int i=1;i<=10000000;i++)
{
Hash[i]=i;
}
cout<<(time(0)-x)<<endl;
x=time(0);
for(int i=1;i<=10000000;i++)
{
Hash[i];
}
cout<<(time(0)-x)<<endl;
}