View Code of Problem 47

#include <stdio.h>
#include <math.h>

int main(void)
{
	int i,j,k,count = 0;
	
	for (i=0; i<=20; i++)
	{
		for (j=0; j<=33; j++)
		{
			if (i*5+j*3+(100-i-j)/3==100  && (100-i-j)%3 == 0)
			{
				count++;
				printf("方案%d:公鸡%d只 母鸡%d只 小鸡%d只\n", count, i, j, 100-i-j); 
									
			}
			
		}
	}
	
	return 0;	
}

Double click to view unformatted code.


Back to problem 47