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 1496. Spammer

CE
Posted by Alexander Prokazyuk (TKTL) 21 Oct 2006 22:28
Anybody help me with my program
I got CE but at my computer I can
Compile it easily

Here is my solution:

1496.pas
var a,a2:array[1..100]of string[30];
    s:string;
    n,i,j,p,k,ans,m:integer;
begin readln(n);
      m:=n;
      for i:=1 to n do
      begin readln(s);
            a[i]:=s;
      end;
      for i:=1 to n do  a2[i]:=a[i];
      for i:=1 to m do
      begin
            for j:=1 to m do
            begin if (i<>j)and(a2[i]=a2[j]) then
            begin p:=0;
                  a2[j]:='';
                  for k:=j to m do
                      begin a2[k]:=a2[k+1];
                            a2[k+1]:='';
                      end;
                  dec(m);
                  j:=0;
            end;
            end;
      end;
      for i:=1 to m do
      begin ans:=0;
            for j:=1 to n do
            if a[j]=a2[i] then inc(ans);
            if ans>1 then writeln(a2[i]);
      end;

end.

Exquse me for my bad English

Edited by author 21.10.2006 22:29
Re: CE
Posted by Kaliningrad SU -J_A_MES-HeadLiner 21 Oct 2006 23:01
Don't use cycle's parametr inside cycle:
for j:=1 to m do begin
...
j:=0;
...
end;
Another Problem
Posted by Alexander Prokazyuk (TKTL) 22 Oct 2006 12:17
I have changed my code now it can't pass
#7 test
Can you say if input for example 4
and all "names" are different what must
programm write in output?!

P.S Ecuse me for my bad English.

Edited by author 22.10.2006 12:17

Edited by author 22.10.2006 12:21
Re: Another Problem
Posted by mai7 27 Oct 2006 16:47
Try to change string length to 31. I had WA on 7th, and after this took AC.