fork(1) download
  1. #include <cmath>
  2. #include <iostream>
  3.  
  4. bool is_cube(double r)
  5. {
  6. return floor(cbrt(r)) == cbrt(r);
  7. }
  8.  
  9. bool inline is_cube_inline(double r)
  10. {
  11. return floor(cbrt(r)) == cbrt(r);
  12. }
  13.  
  14. int main()
  15. {
  16. double value;
  17. std::cin >> value;
  18. std::cout << (floor(cbrt(value)) == cbrt(value)) << std::endl;
  19. std::cout << (is_cube(value)) << std::endl;
  20. std::cout << (is_cube_inline(value)) << std::endl;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
27.0
stdout
0
0
0