Search found 1 match

by qsort
Mon Jan 27, 2003 3:34 pm
Forum: Volume 4 (400-499)
Topic: 439 - Knight Moves
Replies: 33
Views: 11365

floyd-warshall

using floyd-warshall one can write a quite short solution, too #define f(a) for(a=0;a<64;a++) main(){int s[64][64],i,j,k,l;f(i)f(j)s [j]=i-j?abs(i%8-j%8)*abs(i/8-j/8)-2?42:1:0;f(j)f(i)f(k){l=s [j]+s[j][k];if(l<s [k])s [k]=l;}while(scanf("%c%d %c%d\n",&i,&j,&k,&l)>3)printf("To get from %c%d to %c%d t...

Go to advanced search