Results 1 to 12 of 12
Thread: C++
Hybrid View
-
9th March 2011 12:07 #1Registered User
Join Date: Feb:2011
Location: Sofia
Posts: 18
C++
,

.
" W H 8x8 , "" , , 1 "
-
9th March 2011 12:18 #2
.
.Have no fear ike iz here.
CPU Cx486DLC@40MHz, RAM 4MB, VGA Trident 512KB, HDD Conner 160MB, Monitor 14" Color
-
9th March 2011 12:28 #3Registered User
Join Date: Feb:2011
Location: Sofia
Posts: 18
,Code:#include <stdio.h> #define N 8 #define N2 N*N #define IN(I) (((I)>=0) && ((I)<N)) int T[N][N]; /* TABLE */ int H[8]; /* HORZ DELTA */ int V[8]; /* VERT DELTA */ int R; void INIT(); void OUTP(); int MOVE(int,int,int); int main() { INIT(); MOVE(2,0,0); OUTP(); return 0; } void INIT() { int I,J; T[0][0]=1; for(I=1;I<N;I++) for(J=1;J<N;J++) T[I][J]=0; H[0]= 1; V[0]= 2; H[1]= 2; V[1]= 1; H[2]= 2; V[2]=-1; H[3]= 1; V[3]=-2; H[4]=-1; V[4]=-2; H[5]=-2; V[5]=-1; H[6]=-2; V[6]= 1; H[7]=-1; V[7]= 2; } void OUTP() { int I,J; if(R) for(I=0;I<N;I++){ for(J=0;J<N;J++) printf("%.2d ",T[I][J]); printf("\n");} else printf("No solution\n"); } int MOVE(int P,int X,int Y) { int I,J,K=0; M1: I=Y+V[K]; J=X+H[K]; R=0;K++; if(IN(I)&&IN(J)) if(T[I][J]==0){ T[I][J]=P; if(P<N2){ MOVE(P+1,J,I); if(R==0)T[I][J]=0;} else R=1;} if(R||K>=8) return; goto M1; }
-
9th March 2011 12:28 #4
-
9th March 2011 12:30 #5, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
9th March 2011 17:24 #6Registered User
Join Date: Feb:2011
Location: Sofia
Posts: 18
.... ... ...
---------- 17:24 ---------- 12:36 ----------
15
(beer)
-
9th March 2011 17:38 #7UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
geniusloci: ) ; ) ; ) ?
nope|r.i.p.
-
9th March 2011 17:39 #8
-
9th March 2011 17:42 #9Registered User
Join Date: Feb:2011
Location: Sofia
Posts: 18
.
-
9th March 2011 17:34 #10
-
9th March 2011 17:37 #11
-
9th March 2011 17:41 #12
, anrieff , .
: 2 ,: XaMaB; . 0.42
In God we Trust (all others must submit a X.509 certificate). , ()




Reply With Quote


Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in