| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
菜鸟70题纪念。。。code贴上。。。#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;
const int fac[]={2,3,5};
int main()
{
double x,ug[1507];
int n;
vector<double> h(1);
h[0]=-1;
for(int i=1;i<=1501;i++)
{
x=h[0];
ug[i]=-x;
pop_heap(h.begin(),h.end());
h.pop_back();
for(int j=0;j<3;j++)
{
if(find(h.begin(),h.end(),x*fac[j])==h.end())
{
h.push_back(x*fac[j]);
push_heap(h.begin(),h.end());
}
}
}
while(cin>>n)
{
if(!n)
break;
printf("%.0lf\n",ug[n]);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator