|
|
вернуться в форумHelpMe. 1002 Послано Sergey 23 апр 2003 17:22 Why WrongAnswer? Help me plz! { @JUDGE_ID: 21830HZ 1002 Pascal } var Number,tmp,otv:string; a:array[0..50000]of integer; mas:array[1..50000]of string; n,i,k,s,s0:integer; ch:boolean; begin Readln(Number); ch:=false; for i:=1 to length(number) do begin case Number[i]of '1': S0:=s0+1; '2': S0:=s0+2; '3': S0:=s0+3; '4': S0:=s0+4; '5': S0:=s0+5; '6': S0:=s0+6; '7': S0:=s0+7; '8': S0:=s0+8; '9': S0:=s0+9; '0': S0:=s0+0; end; end; readln(n); for i:=1 to n do begin readln(mas[i]); for k:=1 to length( mas[i]) do begin case Mas[i][k] of 'i','j': S:=s+1; 'a','b','c': S:=s+2; 'd','e','f': S:=s+3; 'g','h': S:=s+4; 'k','l': S:=s+5; 'm','n': S:=s+6; 'p','r','s': S:=s+7; 't','u','v': S:=s+8; 'w','x','y': S:=s+9; 'o','q','z': S:=s+0; end; end; a[i]:=s; s:=0;
otv:='GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG'; end; for i:=1 to n do begin for k:=2 to n do begin if (a[i]+a[k]=s0)and(length(mas[i]+' '+mas[k])<length (otv)) then begin otv:=mas[i]+' '+mas[k]; ch:=true; end; end; end; for i:=1 to n do begin if a[i]=s0 then begin otv:=mas[i]; ch:=true; end; end; case ch of true:writeln(otv); false:writeln('No solution'); end; readln; end. |
|
|