#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x1,x2,x3,x4,x5;
int a,b,c,d,e;
double max=0.0,x;
for(x5=0;x5<=2;x5++)
{
for(x4=0;x4<=(20-x5*8)/5;x4++)
{
for(x3=0;x3<=(20-x5*8-x4*5)/3;x3++)
{
for(x2=0;x2<=(20-x5*8-x4*5-x3*3)/2;x2++)
{
x1=20-8*x5-x4*5-x3*3-x2*2;
x=2000.0*pow((1+0.0063*12),x1)
*pow((1+0.0066*2*12),x2)
*pow((1+0.0069*3*12),x3)
*pow((1+0.0075*5*12),x4)
*pow((1+0.0084*8*12),x5);
if(x>max)
{
max=x;
a=x1;
b=x2;
c=x3;
d=x4;
e=x5;
}
}
}
}
}
cout<<max<<endl;
cout<<"存一年几次:"<<a<<endl;
cout<<"存二年几次:"<<b<<endl;
cout<<"存三年几次:"<<c<<endl;
cout<<"存五年几次:"<<d<<endl;
cout<<"存八年几次:"<<e<<endl;
}