5位运动员参加了10米台跳水比赛,有人让他们预测比赛结果
2016-07-29 19:34
429 查看
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c,d,e;
for(a=1;a<=5;a++)
{
for(b=1;b<=5;b++)
{
for(c=1;c<=5;c++)
{
for(d=1;d<=5;d++)
{
for(e=1;e<=5;e++)
{
if(((b==1)+(a==3)==1)&&((b==2)+(e==4)==1)&&
((c==1)+(d==2)==1)&&((c==5)+(d==3)==1)
&&((e==4)+(a==1)==1))
{
int ret=0;
int flag=1;
ret|=(1<<(a-1));
ret|=(1<<(b-1));
ret|=(1<<(c-1));
ret|=(1<<(d-1));
ret|=(1<<(e-1));
while(ret)
{
if(ret%2==0)
{
flag=0;
}
ret/=2;
}
if(flag==1)
{
printf("a=%d b=%d c=%d d=%d e=%d",a,b,c,d,e);
}
printf("\n");
}
}
}
}
}
}
system("pause");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c,d,e;
for(a=1;a<=5;a++)
{
for(b=1;b<=5;b++)
{
for(c=1;c<=5;c++)
{
for(d=1;d<=5;d++)
{
for(e=1;e<=5;e++)
{
if(((b==1)+(a==3)==1)&&((b==2)+(e==4)==1)&&
((c==1)+(d==2)==1)&&((c==5)+(d==3)==1)
&&((e==4)+(a==1)==1))
{
int ret=0;
int flag=1;
ret|=(1<<(a-1));
ret|=(1<<(b-1));
ret|=(1<<(c-1));
ret|=(1<<(d-1));
ret|=(1<<(e-1));
while(ret)
{
if(ret%2==0)
{
flag=0;
}
ret/=2;
}
if(flag==1)
{
printf("a=%d b=%d c=%d d=%d e=%d",a,b,c,d,e);
}
printf("\n");
}
}
}
}
}
}
system("pause");
return 0;
}
相关文章推荐
- c primer plus第16章总结:C预处理器和C库
- 使用 Math 类操作数据
- 十八、备忘录模式Memento(行为型)
- 从Qt4 迁移到Qt5 winEvent代替为nativeEvent
- 使用 CXF 开发 SOAP 服务
- 马哥预习视频
- PHP判断指定时间段的2个方法
- java中,为什么有些类不需要导入?
- 通用
- 折半算法
- 十七、中介者模式Mediator(行为型)
- 十六、迭代器模式Iterator(行为型)
- linphone-Tunnelconfig.java文件分析
- poj 1190 生日蛋糕
- 对于异常的捕捉
- 51NOD 1556 计算 (默慈金数)
- .bash_profile和.bashrc的区别(如何设置生效)
- App启动时的欢迎界面
- 自己搭建android compile引用库,把aar (library)上传到bitbucket的maven仓库(by 星空武哥)
- c#之线程