题目描述
鸡兔同笼问题:一个笼子里面有鸡若干只,兔若干只。共有头50个,共有腿160条。求鸡兔各多少只?
输入
无
输出
两个整数,在一行。 鸡的只数 兔的只数 中间空格隔开!
#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;
}
还可以偷鸡!代码奉上
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout<<20<<' '<<30<<endl;
}
return 0;
}
还可以
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout<<20<<' '<<30;
}
return 0;
}
嗨嗨嗨886~~~
等等下次发啥!