hdu 4392 Maximum Number Of Divisors(三)

2014-11-24 10:23:12 · 作者: · 浏览: 6
nt temp;
while(!q.empty())
{
now = *q.begin();
q.erase(q.begin());
temp = inf;
for(int i=0;i<62;i++)
{
to = now;
if(now.a[i] {
to.a[i]=now.a[i]+1;
to.x = now.x * p[i];
to.has = now.has /(now.a[i]+1);
to.has *= to.a[i]+1;

mi = M.upper_bound(to.x);
mi -- ;

if(mi->second < to.has)
{
M[to.x]=to.has;
if(to.x {
q.insert(to);
}
while(true)
{
mi=M.upper_bound(to.x);
if(mi == M.end()) break;
if(mi->second <= to.has)
{
M.erase(mi);
}
else
{
break;
}
}
}
temp = now.a[i];
}
else if(now.a[i]==temp)
{
continue;
}
else
{
break;
}
}
}
return ;
}

bool isp(int x)
{
for(int i=0;p[i]*p[i]<=x;i++)
{
if(x%p[i]==0)
{
return false;
}
}
return true;
}

void initp()
{
p.clear();
p.push_back(2);
for(int i=3;i<1000;i++)
{
if(isp(i))
{
p.push_back(i);
}
}
return ;
}

int main()
{
initp();
bfs();
/* for(mi=M.begin();mi!=M.end();mi++)
{
cout<first<<" | "<second< }*/
bignum x;
while(cin>>x)
{
mi = M.upper_bound(x);
mi--;
cout<first<<" "<second< }
return 0;
}