Run ID:110114
提交时间:2025-02-14 18:08:34
#include <iostream> using namespace std; int main() { int N; cin >> N; int solutions = 0; // 记录解的个数 for (int x = 0; x <= N / 7; ++x) { if ((N - 7 * x) % 4 == 0) { int y = (N - 7 * x) / 4; int z = N - x - y; if (z >= 0) { solutions++; cout << solutions << ": " << x << "," << y << "," << z << endl; } } } if (solutions == 0) { cout << "None" << endl; } return 0; }