题解 | #百钱买百鸡问题#
百钱买百鸡问题
https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
#include <stdio.h> int main() { getchar(); int g = 100/5; int m = 100/3; int x = 100*3; for(int i = 0; i <= g; i++) for(int j = 0; j <= m; j++) for(int k = 0; k < x; k+=3) { if((i+j+k == 100) && (i*5+j*3+k/3 == 100)) printf("%d %d %d\n",i,j,k); } return 0; }