标签:bsp clu blog sso content 小学生 pos center cpp
题目要求:
输入代码:
#include <iostream>
using namespace std;
int main()
{
int m,n,ch,tu,count;
cin>>m>>n;
while(m||n)//控制输入。当出现0 0等相似输入时停止循环
{
count=0;
for ( tu=0; tu<m; tu++)
{
int ch = m -tu;//鸡的个数
if ( (4*tu + 2*ch)== n)//兔子的个数x4+鸡的个数x2==总脚数\\这道题的算法
{
cout<<ch<<" "<<tu<<endl;
count++;
}
}
if(count==0)
{
cout<<"Error"<<endl;//不符合实际的输出错误
}
cin>>m>>n;
}
return 0;
}
总结:
小学生的数学题,拿来重温童年的感觉。
。。
嘻嘻
标签:bsp clu blog sso content 小学生 pos center cpp
原文地址:http://www.cnblogs.com/ljbguanli/p/7026904.html