fork download
  1. #include<stdio.h>
  2. #include<iostream>
  3. #include<math.h>
  4. #include<stdlib.h>
  5. using namespace std;
  6.  
  7. long long mylog2(long long k)
  8. {
  9. long long temp=1;
  10. long long i=0;
  11. while(temp<k)
  12. {
  13. temp=temp*2;
  14. i++;
  15. }
  16. if(temp==k)
  17. return i;
  18. else return i-1;
  19. }
  20.  
  21. double mypow(long long n)
  22. { double temp ;
  23. if(n==0)
  24. return 1;
  25. if(n==1)
  26. return 2;
  27. else
  28. {
  29. temp = mypow(n/2);
  30. if(n%2)
  31. temp = temp*temp*2;
  32. else
  33. temp = temp*temp;
  34. }
  35. return temp;
  36. }
  37.  
  38. int main()
  39. {
  40. int p=10000; // change this to 1000 or any other value less than that
  41. double x= pow(2,p);
  42. double y= mypow(p);
  43. cout<<x<<" "<<y;
  44. return 0;
  45. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
inf inf