There are 36 bricks, which are moved by 36 people; men move 4 yuan at a time, women 3 yuan at a time, and two children carry one piece at a time. What are the male, female, and child?

#include<stdio.h>
int main()
{
    
    
	int m,w,c;
	for(m=0;m<=9;m++){
    
    
		for(w=0;w<=12;w++){
    
    
			c=36-m-w;
			if((m*4+w*3+c/2==36)&&(c%2==0)){
    
    
				printf("男人:%d,女人:%d,小孩:%d\n",m,w,c);
			}
		}
	}
	return 0;
}

Guess you like

Origin blog.csdn.net/buxiangquaa/article/details/114990271