← Back to topics
Topic

Help [Tajna]

g
gigac
Can I get Tests 8 and 9..
I get the rest, but it fails on these one.
btw, this is my code

Var R,C : Integer;
S,S1 : String[100];
mR,mC : Integer;
A : Array[1..10,1..10] Of String[1];

Begin
ReadLn(S);
mR:=0;
For R:=1 To Length(S) Do
For C:=1 To Length(S) Do
Begin
If R*C = Length(S) Then
If (R > mR) And (R<=C) Then Begin mR:=R; mC:=C; End;
End;

For C:=1 To mC Do
For R:=1 To mR Do
Begin
A[R,C]:=S[1];
Delete(S,1,1);
End;
S1:='';
For R:=1 To mR Do
For C:=1 To mC Do S1:=S1 + A[R,C];

WriteLn(S1);
End.
b
boris4
why is your array A just [ 1..10 ][ 1..10 ] ??

for example take any prime number greater then 10, 17 for example.

Now you have to make matrix 17x1, and you can't...

So try to put

A : array[ 1..100 ][ 1..100 ]
g
gigac
Thanks :)