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 1213. Cockroaches!

For all Who used hash and got WA6
Posted by SP2 25 Sep 2007 20:12
I used hash which have pased all tests
I have got WA6 several times
here is my program
program Project2;

{$APPTYPE CONSOLE}
const s=['a'..'z','A'..'Z','0'..'9'];


var name:array[1..10000000] of boolean;
    c,n,i,j:longint;
    ch:char;
    str:string;

begin
readln(str);
read(ch);
if ch='#' then begin writeln('0');  exit; end;
while ch <> '#' do
begin
 c:=100*ord(ch);
 j:=0;
 while (ch in s)and(ch<>'#') do begin c:=c+ord(ch); read(ch); inc(j); end;
 name[c]:=true;
 while (not (ch in s))and(ch <> '#') do read(ch);
end;

j:=0;
for i:=1 to 10000000 do if name[i] then inc(j);

writeln(j-1);

readln;
readln;
end.
Re: For all Who used hash and got WA6
Posted by Dimaphil 26 Nov 2009 19:36
Only delete
  readln;
  readln;

And all will be OK!