不,但是写一个很容易:
bool is_perfect_square(int n) { if (n < 0) return false; int root(round(sqrt(n))); return n == root * root;}bool is_perfect_cube(int n) { int root(round(cbrt(n))); return n == root * root * root;}
不,但是写一个很容易:
bool is_perfect_square(int n) { if (n < 0) return false; int root(round(sqrt(n))); return n == root * root;}bool is_perfect_cube(int n) { int root(round(cbrt(n))); return n == root * root * root;}