Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
108942 | 彭士宝 | 百钱买百鸡II | C++ | Accepted | 2 MS | 272 KB | 539 | 2025-01-23 17:14:44 |
#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; }