#include<iostream>
#include<cstdlib>
using namespace std;
void test(int R , int F ,int &Num, double *&D){
double total=0;
D = new double[1000];
Num=0;
do{
D[Num]=R+F;
total+=D[Num];
Num++;
}while(total<=9);
do{
D[Num]=(R+F)/2;
total+=D[Num];
Num++;
}while(total<=19);
for(int i=1; i<Num; i++){
D[i]+=D[i-1];
}
cout<<"Num= "<<Num<<endl;
}
int main(){
int R,F;
int Num;
double *D;
//double *D=new double[1000];
//double D[1000];
cout<<"please input R & F: "<<endl;
cout<<"R: ";
cin>>R;
cout<<"F: ";
cin>>F;
test(R,F,Num,D);
for(int i=0;i<Num;i++){
cout<<D[i]<<endl;
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNzdGRsaWI+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCB0ZXN0KGludCBSICwgaW50IEYgLGludCAmTnVtLCBkb3VibGUgKiZEKXsKCmRvdWJsZSB0b3RhbD0wOwpEID0gbmV3IGRvdWJsZVsxMDAwXTsKTnVtPTA7CgogICAgZG97CiAgICAgICAgRFtOdW1dPVIrRjsKICAgICAgICB0b3RhbCs9RFtOdW1dOwogICAgICAgIE51bSsrOwogICAgfXdoaWxlKHRvdGFsPD05KTsKICAgIGRvewogICAgICAgIERbTnVtXT0oUitGKS8yOwogICAgICAgIHRvdGFsKz1EW051bV07CiAgICAgICAgTnVtKys7CiAgICB9d2hpbGUodG90YWw8PTE5KTsKCiAgICBmb3IoaW50IGk9MTsgaTxOdW07IGkrKyl7CiAgICAgICAgRFtpXSs9RFtpLTFdOwogICAgfQogICAgY291dDw8Ik51bT0gIjw8TnVtPDxlbmRsOwp9CgppbnQgbWFpbigpewoKaW50IFIsRjsKaW50IE51bTsKZG91YmxlICpEOwovL2RvdWJsZSAqRD1uZXcgZG91YmxlWzEwMDBdOwovL2RvdWJsZSBEWzEwMDBdOwpjb3V0PDwicGxlYXNlIGlucHV0IFIgJiBGOiAiPDxlbmRsOwogICAgICAgIGNvdXQ8PCJSOiAiOwogICAgICAgIGNpbj4+UjsKICAgICAgICBjb3V0PDwiRjogIjsKICAgICAgICBjaW4+PkY7CiAgICAgICAgdGVzdChSLEYsTnVtLEQpOwoKZm9yKGludCBpPTA7aTxOdW07aSsrKXsKCiAgICBjb3V0PDxEW2ldPDxlbmRsOwp9CgpyZXR1cm4gMDsKCn0K