cc • 1年前
int main() {
/*
1.(5*x + 3*y + (1/3)* z = 100)
2.(x + y +z = 100)
3.(7*x + 4y = 100)
4.如果 (100 - 7x)%4 == 0,则留下x值,并计算y=(100-7x)/4及z=100-x-y值
5.x最大取到[100/7] = 15
*/
int x = 0, y = 0, z = 0;
for (x; x <= 15; x++) {
if ((100 - 7 * x) % 4 == 0) {
y = (100 - 7 * x) / 4;
z = 100 - x - y;
printf("%d %d %d \n", x, y, z);
}
}
return 0;
}
评论:
请先登录,才能进行评论