#include<stdio.h>
#include <math.h>
int main()
{
int a,b,c,d,e,a1,b1,c1,d1,e1;double w,m=0;
for(a=0;a<=20;a++)
for(b=0;b<=10;b++)
for(c=0;c<=6;c++)
for(d=0;d<=4;d++)
for(e=0;e<=2;e++)
{
if(a+b*2+c*3+d*5+e*8==20)
w=2000*pow(0.0063*12+1,a)*pow(0.0066*24+1,b)*pow(0.0069*36+1,c)*pow(0.0075*60+1,d)*pow(0.0084*96+1,e);//pow(a,b)表示a的b次方,需要头文件#include <math.h>
if( m<w){
m=w;a1=a;b1=b;c1=c;d1=d;e1=e;
}
}
printf("%d %d %d %d %d\n%.2lf",e1,d1,c1,b1,a1,m);
return 0;
}
你会存钱吗?
最新推荐文章于 2022-10-28 21:25:47 发布