楊輝三角,誰是兇手,比賽排名

#include <stdio.h>
int main()
{
	int m=0,n=0;
	static int a[10][10]={0,0};
    a[0][1]=1;
	for(m=1;m<10;m++)
	{
		for(n=1;n<2*m-(n-1);n++)
		{
	       a[m][n]=a[m-1][n-1]+a[m-1][n];
		   printf("%4d",a[m][n]);
		}
		printf("\n");
	}

 return 0;
}

#include <stdio.h>

void main()

{

 int A,B,C,D,i;

 for(i=0;i<4;i++)

 {

   switch(i)

   {

     case 0:A=0,B=1,C=1,D=1;

         break;

case 1:A=1,B=0,C=1,D=1;

break;

case 2:A=1,B=1,C=0,D=1;

break;

case 3:A=1,B=1,C=1,D=0;

break;

default:break;

   }

 if(A+B+C==2&&B+C==1&&C+D==1)

    printf("%c is killer.\n",i+'A');

}

 return 0;

}


#include <stdio.h>

int main()

{

int a,b,c,d,e;

int sum=0;

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))&&((b==2)^(e==4))&&((c==1)^(d==2))&&((c==5)^(d==3))&&((e==4)^(a==1))==1)

{

 

printf("a=%d b=%d c=%d d=%d e=%d\n",a,b,c,d,e);

   //sum++;

return 0;

}


 }

      

  }   

}

      

  }  

 

}

//printf("sum=%d\n",sum);

  return 0;

}



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章