菜鸟的博客

纵有疾风起,人生不言弃。

导航

2023.4.10

#include <iostream>
using namespace std;
int main()
{
int cock,hen,chicken;
for(cock = 0;cock<=20;cock++)
{
for(hen = 0;hen<=33;hen++)
{
for(chicken = 0;chicken<=100;chicken++)
{
if(cock+hen+chicken == 100&& 5*cock+3*hen+chicken/3==100 && chicken%3==0)
{
cout<<"cock = "<<cock<<","<<"hen = "<<hen<<","<<"chicken = "<<chicken<<","<<endl;
}
}
}
}
return 0;
}

 

 

#include <iostream>
using namespace std;
int main()
{
//对五本书进行编号1,2,3,4,5
int a,b,c;
for(a=1;a<=5;a++)
{
for(b=1;b<=5;b++)
{
for(c=1;c<=5;c++)
{
if(a!=b&&a!=c&&b!=c)
{
cout<<"A选:"<<a<<","<<"B选:"<<b<<","<<"C选:"<<c<<endl;
}
}
}
}
return 0;
}

 

posted on 2023-04-10 22:20  hhmzd233  阅读(1)  评论(0编辑  收藏  举报