38 lines
708 B
C++
38 lines
708 B
C++
#include <iostream>
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
|
|
vector<int> calc_factors( int num) {
|
|
vector<int> factors;
|
|
for (const int factor : {3,5,7}) {
|
|
if (num % factor == 0) {
|
|
factors.push_back(factor);
|
|
}
|
|
}
|
|
return factors;
|
|
}
|
|
|
|
int num;
|
|
vector<int> factors;
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(false);
|
|
cin.tie(nullptr);
|
|
|
|
cin >> num;
|
|
factors = calc_factors(num);
|
|
if (factors.empty()) {
|
|
cout << "n" << endl;
|
|
} else {
|
|
int temp = factors[factors.size() - 1];
|
|
factors.pop_back();
|
|
for (const int factor : factors) {
|
|
cout << factor << " ";
|
|
}
|
|
cout << temp << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|