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 1585. Penguins

Rudnev Vladimir Why i got crash??? [3] // Problem 1585. Penguins 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;
read(n);
for i:=1 to n+1 do begin
readln(a[i]);
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.
Sergey Lazarev (MSU Tashkent) Re: Why i got crash??? [2] // Problem 1585. Penguins 23 Feb 2010 00:08
Why "for i:=1 to n+1 do"???
Must be "for i:=1 to n do"!!!
Rudnev Vladimir Re: Why i got crash??? [1] // Problem 1585. Penguins 23 Feb 2010 00:13
if i do "for i:=1 to n do" then (не знаю как дальше поанглийски) Короче он вводит на 1 меньше
Sergey Re: Why i got crash??? // Problem 1585. Penguins 23 Feb 2010 00:32
Change "read(n)" to "readln(n)".