#include <stdio.h>
int main()
{
int a, b;
scanf("%d %d", &a, &b);
int x, y;
for (x = 0; x <= a; x++)
{
y = a - x;
if (2 * x + 4 * y == b)
{
printf("chickens = %d; rabbits = %d", x, y);
return 0;
}
}
printf("No solution");
return 0;
}
鸡兔同笼问题
最新推荐文章于 2024-08-26 14:50:03 发布