- P144's solution
-
题解P144
- @ 2025-11-7 18:20:06
按题意模拟即可。
AC code:
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> valid;
for (long long x = 1; 2 * x <= n; x++) {
valid.push_back(x);
}
if (valid.empty()) {
cout << "NO!" << endl;
} else {
cout << valid.size() << endl;
for (long long x : valid) {
cout << x << " ";
}
cout << endl;
}
return 0;
}