最新更正一下~曾经引用5楼代码的注意一下~原来输出结果有问题,现在已经改正~
[code]/*~个性签名:bug是什么意思?bug是看上去没有可能的东西实际上是有可能做到的 就是这样~2018-08-08更~*/[/code]
#include<stdio.h> int main() { char *p[]={"洞庭湖","洪泽湖","鄱阳湖","太湖"}; int a[24][4]= { {1,2,3,4},{1,2,4,3},{1,3,2,4},{1,3,4,2},{1,4,2,3},{1,4,3,2}, {2,1,3,4},{2,1,4,3},{2,3,1,4},{2,3,4,1},{2,4,1,3},{2,4,3,1}, {3,1,2,4},{3,1,4,2},{3,2,1,4},{3,2,4,1},{3,4,1,2},{3,4,2,1}, {4,1,2,3},{4,1,3,2},{4,2,1,3},{4,2,3,1},{4,3,1,2},{4,3,2,1} }; int i=0; for (i=0;i<24;i++) { int j=0; if (((a[i][0]==1)+(a[i][1]==4)+(a[i][2]==3))!=1) continue; if (((a[i][1]==1)+(a[i][0]==4)+(a[i][2]==2)+(a[i][3]==3))!=1) continue; if (((a[i][1]==4)+(a[i][0]==3))!=1) continue; if (((a[i][2]==1)+(a[i][3]==4)+(a[i][1]==2)+(a[i][0]==3))!=1) continue; for (j=0;j<4;j++) printf("%-10s%d\n",p[j],a[i][j]); } return 0; }
[此贴子已经被作者于2017-2-9 16:05编辑过]