您的位置:首页 > 其它

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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: