give me a hand

var

ch : char;

a : array[ 0 .. 100 ] of char;

b : array[ 0 .. 20 , 0 .. 20 ] of longint;

c : array[ 0 .. 100 ] of longint;

i , j , k , n : longint;

function pd : boolean;

var

i , j , k : longint;

begin

for i := 1 to n do

for j := 1 to n do

if ( c[ i ] +c[ b[ 0 , j ] ] =c[ b[ i , j ] mod 10 ])or( c[ i ] +c[ j ] =c[ b[ i , j ] mod 10 ] +n )

then

else exit( false );

pd := true;

end;

function find1 : longint;

var

i , j : longint;

begin

for i := 1 to n do

for j := 1 to n do

if b[ i , j ] >9

then exit( b[ i , j ] div 10 );

find1 := -1;

end;

begin

readln;

read( ch , ch );

i := -1;

while not( eof ) do

begin

inc( i );

if i =0 then j := 1

else j := 0;

while not( eoln ) do

begin

read( ch );

if ch = ' '

then inc( j )

else begin

k := 1;

while ( k n

then begin

inc( n );

a[ n ] := ch;

end;

b[ i , j ] := b[ i , j ] *10 +k;

end;

end;

readln;

end;

for i := 1 to n do

c[ i ] := -1;

k := find1;

if k =-1

then writeln( 'Wrong!' )

else begin

for i := 1 to n do

if b[ k , i ] =k

then begin

c[ i ] := 0;

break;

end;

j := i;

for i := 1 to n do

begin

j := b[ k , j ];

c[ j ] := i;

end;

if pd

then begin

for i := 1 to n -1 do

write( a[ i ] , '=' , c[ i ] , ' ' );

writeln( a[ n ] , '=' , c[ n ] );

writeln( n );

end

else writeln( 'Wrong!' );

end;

end.

I can't understand this question what's wrong with my program?

THX

0 条评论

目前还没有评论...

信息

ID
1596
难度
7
分类
搜索 点击显示
标签
递交数
667
已通过
109
通过率
16%
被复制
6
上传者