public class Solution326 {
public boolean isPowerOfThree(int n) {
double temp = 10e-15;
if(n==0) return false;
double res = Math.log(n) / Math.log(3);
return Math.abs(res-Math.round(res)) < temp; //或者Math.rint();
}
public static void main(String[]args)
{
int n=243;
System.out.println(isPowerOfThree(n));
}
}