Files
python/TangDou/ShuLun/SL5.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
364 B
C++

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