P1163 银行贷款(1.26)
点击查看代码
#include<bits/stdc++.h>
using namespace std;
double w,k;
int m;
bool check(double x)
{
double rest=w;
for(int i=0;i<m;i++){
rest=rest*(1+x)-k;
}
return rest>0;
}
int main()
{
cin>>w>>k>>m;
double l=0,r=3;
for(int i=0;i<100;i++){
double mid=(l+r)/2;
if(check(mid)) r=mid;
else l=mid;
}
printf("%.1lf",l*100);
return 0;
}

浙公网安备 33010602011771号