Preface
Content
Problem
判断一个数是否是质数;
给大树作质因数分解;
Solution
Example
void divide(int n) {
for (int i = 2; i <= n / i; ++i) {
if (n % i == 0) {
int s = 0;
while (n % i == 0) {
s ++;
n /= i;
}
cout << i << ' ' << s << endl;
}
}
if (n > 1) cout << n << ' ' << 1 << endl;
cout << endl;
}