fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define eps 1e-4
  4. double a,b,c;
  5. bool check(double x){
  6. double sum=0,t=1;
  7. for(int i=1;i<=c;i++){
  8. t/=(1+x),
  9. sum+=t;
  10. }
  11. return sum>1.0*a/b;
  12. }
  13. int main(){
  14. cin>>a>>b>>c;
  15. double r=5,l=0,ans=0;
  16. while(r-l>eps){
  17. double mid=(r+l)/2;
  18. if(check(mid)){
  19. l=mid;
  20. ans=mid;
  21. }else{
  22. r=mid;
  23. }
  24. }
  25. printf("%.1lf",ans*100);
  26. return 0;
  27. }
Success #stdin #stdout 0s 5316KB
stdin
1000 100 12
stdout
2.9