|
|
вернуться в форумwhat is wrong in my solution? Program N1744; Var n,i,j,t,k:integer; A:array[1..100,1..100] of integer; R:array[1..50000,1..3] of integer; begin Readln(n); for i:=1 to N do for j:=1 to N do if i<>j then A[i,j]:=0 else A[i,j]:=3; k:=0; for i:=1 to N do for j:=1 to n do for t:=1 to n do if (A[i,j]<3)and(A[i,t]<3) and(A[j,t]<3) then begin inc(k); R[k,1]:=i; R[k,2]:=j; R[k,3]:=t; inc(A[i,j]); inc(A[i,t]); inc(A[j,t]); inc(A[j,i]); inc(A[t,i]); inc(A[t,j]); end; writeln(k); for i:=1 to k do writeln(R[i,1],' ',R[i,2],' ',R[i,3]); Readln; end. is there a difference in what order the output numbers of soldiers? Edited by author 24.01.2010 16:02 Edited by author 24.01.2010 16:03 For n=7 your program returns k=13 and for n=9 k=28, but correct answers are 21 and 36 Edited by author 27.01.2010 04:07 Can you write full output for n=7 ? For example, 21 1 2 3 1 2 3 1 2 3 1 4 5 1 4 5 1 4 5 1 6 7 1 6 7 1 6 7 2 4 6 2 4 6 2 4 6 2 5 7 2 5 7 2 5 7 3 4 7 3 4 7 3 4 7 3 5 6 3 5 6 3 5 6 I hope, it will help you. |
|
|