You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
364 B

#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;
}