题目描述
鸡兔同笼问题:一个笼子里面有鸡若干只,兔若干只。共有头50个,共有腿160条。求鸡兔各多少只?
(6.2.32)
输出
两个整数,在一行。
鸡的只数 兔的只数 中间空格隔开!
#include <bits/stdc++.h>
using namespace std;
int main()
{
int j,t,tou=50,tui=160;
for(j=1;j<=tou;j++)
{
t=tou-j;
if(j*2+t*4==tui)
cout<<j<<' '<<t<<endl;
}
return 0;
}