some programs!

This commit is contained in:
rogerwang2008 committed 2026-09-25 20:20:01 +08:00
1 parent 5d30e847c1
commit ed054247d5
32 files changed
+1882 -149

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
#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;
}