标签:not spl audio while int turn lse div controls
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 /*错误代码 5 bool solve(long long n) 6 { 7 if(n%3==0) 8 return true; 9 else 10 return false; 11 }*/ 12 13 //题目给出32bit整数,可以依此来确定3在32bit下的最高次幂值,然后做模运算 14 bool solve(long long n) 15 { 16 if(1162261467%n==0) 17 return true; 18 return false; 19 } 20 21 int main() 22 { 23 int t; 24 cin>>t; 25 while(t--) 26 { 27 long long n; 28 cin>>n; 29 if(solve(n)) 30 cout<<"Yes"<<endl; 31 else 32 cout<<"No"<<endl; 33 } 34 return 0; 35 }
Check a Integer is power of 3 or not
标签:not spl audio while int turn lse div controls
原文地址:https://www.cnblogs.com/chuanwen-tech/p/11296293.html