Pagini recente » Cod sursa (job #244117) | Cod sursa (job #1299045) | Cod sursa (job #2987416) | Cod sursa (job #2701084) | Cod sursa (job #3164629)
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<vector<int>>H;
int get_nr_cif(int x)
{
int cnt=0;
while(x>0)
{
cnt++
x=x/10;
}
return cnt;
}
long long putere(x,put)
{
long long val=1
while(put>0)
{
val=val*x;
put--;
}
return val;
}
const int b=23;
const int mod=833927;
long long hashumeu(long long x)
{
long long val_cod=0;
int nr_cif=get_nr_cif(x);
while(nr_cif>0)
{
nr_cif--;
val_cod+=putere(b,nr_cif)*x%10;
x=x/10;
}
return val_cod%mod;
}
int main()
{
lon long val_hash;
int n;
int op;
long long x;
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>op>>x;
val_hash=hashumeu(x);
if(op==1)
{
std::vector<int>::iterator it=find(H)
if()
H[val_hash].push_back(x);
}
}
}