acwing——倍增
2023-05-23
70 浏览
4
75 150 75 50
yes
3
100 150 250
no
import java.util.scanner;
public class main {
public static void main(string[] args) {
scanner sc=new scanner(system.in);
int n=sc.nextint();
int[] arr=new int[n];
for (int i=0;i<n;i){
arr[i]=sc.nextint();
while (arr[i]%2==0)
arr[i]/=2;
while (arr[i]%3==0)
arr[i]/=3;
if (i!=0&&arr[i]!=arr[i-1]){//判断也同时进行着
system.out.println("no");
return;
}
}
system.out.println("yes");
}
}
请后发表内容