//鸡翁一,值钱五,鸡母一,值钱三,鸡雏三,值钱一,百钱买百鸡 /* 鸡翁 x 个 5x 鸡母 y 个 3y 小鸡 z 个 z/3 化简为:7*x+4*y=100 */ #include "stdafx.h" #include <iostream> using namespace std; int main() { int x, y, z; for (x = 0; x <= 100; x++) for (y = 0; y <= 100; y++) { if (7 * x + 4 * y == 100) { z = 100 - x - y; cout << "鸡翁:" << x << " 鸡母:" << y << " 鸡雏" << z << endl; } } getchar(); return 0; }
时间: 2024-10-15 01:25:55