Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
提交的总是编译出错?在code::blocks中用c做出来的,但提交总是编译出错,请高手见教,以下是源代码: #include<stdio.h> #include<string.h> #define max 65536 unsigned short int ini; unsigned short int handle[]= { 0xc800,0xe400,0x7200,0x3100, 0x8c80,0x4e40,0x2720,0x1310, 0x08c8,0x04e4,0x0272,0x0131, 0x008c,0x004e,0x0027,0x0013 }; void fun() { if(ini==0x0000||ini==0xffff) { printf("0\n"); return ; } unsigned short int queen[max]; int fpos=-1,epos=0; short int step[max]; queen[0]=ini; memset(step,-1,max); step[ini]=0; while(fpos<=epos) { fpos++; unsigned short int x=queen[fpos]; int i; for(i=0; i<16; i++) { unsigned short int next=x^handle[i]; if(step[next]==-1) { epos++; queen[epos]=next; step[next]=step[x]+1; } if(next==0x0000||next==0xffff) { printf("%d\n",step[next]); return ; } } } printf("Impossible\n"); return ; } int main() { int i,j; ini=0; for(i=0; i<4; i++) { char c; for(j=0; j<4; j++) { scanf("%c",&c); ini<<=1; if(c=='b')ini++; } scanf("%c",&c); } //printf("%d",ini); fun(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator