need help with dynamic programming

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
unsigned int n=0,k,i,x,f=0;
cin>>k;
while(f!=k)
{
n++;
f=0;
x=sqrt(n);
for(i=1;i<=x;i++)
{
if(n%i==0)
{
f++;
}
}
}
cout<<n<<endl;
return 0;
}


i want this program to run less time. it takes 1.014 s but i want it to take less than 1 s.

Last edited on
Turn on full optimisation for speed in your compiler.
Change your algorithm. ¿what is that supposed to do?
Topic archived. No new replies allowed.