题解
2025-04-07 12:25:39
发布于:江苏
5阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
int x;
cin >> x;
vector<vector<int>> results;
for (int i = 0; i <= 100; ++i) {
for (int j = 0; j <= 100; ++j) {
for (int k = 0; k <= 100; ++k) {
for (int z = 0; z <= 100; ++z) {
int sum = 8 * i + 6 * j + 4 * k + 2 * z;
if (sum <= x) {
int p = x - sum;
results.push_back({i, j, k, z, p});
}
}
}
}
}
sort(results.begin(), results.end());
for (const auto& result : results) {
cout << result[0] << " " << result[1] << " " << result[2] << " " << result[3] << " " << result[4] << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个