POJ 1338

 #include<iostream>
#include<stdio.h>
#include<iomanip>
#define MAXN 100000
using namespace std; double a[MAXN];
double x1 = ;
double x2 = ;
double x3 = ;
void give_list(int x,int y,int z);
double min(double a,double b,double c);
int main()
{
//freopen("acm.acm","r",stdin);
double x = ;
double y = ;
double z = ;
give_list(x,y,z);
int num;
while()
{
cin>>num;
if(num == )
break;
cout<<setiosflags(ios::fixed)<<setprecision()<<a[num-]<<endl;
}
} ///////////////////////////////////////////////////////
//由2,3,5,7的乘积组成的数列,由小到大!第一个数默认是1!
///////////////////////////////////////////////////////
void give_list(int x,int y,int z)
{
a[]=;
int len;
double m;
len=;
while(len <= MAXN)//核心的代码,产生器!
{
m=min(a[int(x1)]*x,a[int(x2)]*y,a[int(x3)]*z);
if(m==a[int(x1)]*x)x1++;
if(m==a[int(x2)]*y)x2++;
if(m==a[int(x3)]*z)x3++;
a[len++]=m;
}
} double min(double a,double b,double c)//四个数中最小的;
{
a=a<b?a:b;
a=a<c?a:c;
return a;
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

POJ 1338

技术网站地址: vmfor.com

上一篇:Html5浏览器支持


下一篇:万恶之源 - Python数据类型二