fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <math.h>
  4. using namespace std;
  5. double bin_s(double a, int n){
  6. double l=0, r=1000 , eps=1e-7;
  7. while(abs(l-r)>eps){
  8. double m=(l+r)/2;
  9. double x=pow(m,n);
  10. if(a>x)l=m;
  11. else r=m;
  12. }
  13. return l;
  14. }
  15. int main() {
  16. double a;
  17. int n;
  18. cin>>a>>n;
  19. cout<<fixed<<setprecision(8)<<bin_s(a,n);
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5284KB
stdin
2
2
stdout
1.41421350