ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1164. Fillword

Why WA?!
Posted by Avanesov 22 Mar 2002 19:17
Maybe I did not understand my task right?!
Here is my program:

program p1164;
var
   n,m,p : integer;
   a : array['A'..'Z'] of integer;
   i : integer;
   j : integer;
   ch : char;
begin
  fillchar(a,sizeof(a),0);
  readln(n,m,p);
  for i:=1 to n do
  begin
    for j:=1 to m-1 do
    begin
      read(ch);
      inc(a[ch]);
    end;
    readln(ch);
    inc(a[ch]);
  end;
  for i:=1 to p do
  begin
    for j:=1 to m-1 do
    begin
      read(ch);
      dec(a[ch]);
    end;
    readln(ch);
    dec(a[ch]);
  end;

 for ch:='A' to 'Z' do
 begin
   for i:=1 to a[ch] do Write(ch);
 end;
 writeln;
end.
the lengths of words to fill are not fixed to m
Posted by MadPsyentist/Sam 22 Mar 2002 20:03
> Maybe I did not understand my task right?!
> Here is my program:
>
> program p1164;
> var
>    n,m,p : integer;
>    a : array['A'..'Z'] of integer;
>    i : integer;
>    j : integer;
>    ch : char;
> begin
>   fillchar(a,sizeof(a),0);
>   readln(n,m,p);
>   for i:=1 to n do
>   begin
>     for j:=1 to m-1 do
>     begin
>       read(ch);
>       inc(a[ch]);
>     end;
>     readln(ch);
>     inc(a[ch]);
>   end;
>   for i:=1 to p do
>   begin
>     for j:=1 to m-1 do
>     begin
>       read(ch);
>       dec(a[ch]);
>     end;
>     readln(ch);
>     dec(a[ch]);
>   end;
>
>  for ch:='A' to 'Z' do
>  begin
>    for i:=1 to a[ch] do Write(ch);
>  end;
>  writeln;
> end.
Thanks!
Posted by Avanesov 22 Mar 2002 20:18