'commit'
This commit is contained in:
19
TangDou/ShuLun/SL5.cpp
Normal file
19
TangDou/ShuLun/SL5.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//丑数
|
||||
bool isUgly(int num) {
|
||||
while (num % 2 == 0) num /= 2;
|
||||
while (num % 3 == 0) num /= 3;
|
||||
while (num % 5 == 0) num /= 5;
|
||||
//while (num % 7 == 0) num /= 7;
|
||||
return num == 1;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int num;
|
||||
cin >> num;
|
||||
cout << (isUgly(num) ? "True" : "False");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user