ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1585. Penguins

Why i got crash???
Posted by Rudnev Vladimir 22 Feb 2010 23:15
what's wrong???

var a:array[1..1000] of string;v,b,c,n,i:integer;
begin
b:=0;c:=0;v:=0;
for i:=1 to n+1 do begin
if a[i]='Emperor Penguin' then v:=v+1;
if a[i]='Macaroni Penguin' then b:=b+1;
if a[i]='Little Penguin' then c:=c+1;
end;
if (v>b)and(v>c)then writeln('Emperor Penguin');
if (b>v)and(b>c)then writeln('Macaroni Penguin');
if (c>b)and(c>v)then writeln('Little Penguin');
end.
Re: Why i got crash???
Posted by Sergey Lazarev (MSU Tashkent) 23 Feb 2010 00:08
Why "for i:=1 to n+1 do"???
Must be "for i:=1 to n do"!!!
Re: Why i got crash???
Posted by Rudnev Vladimir 23 Feb 2010 00:13
if i do "for i:=1 to n do" then (не знаю как дальше поанглийски) Короче он вводит на 1 меньше
Re: Why i got crash???
Posted by Sergey 23 Feb 2010 00:32