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 1079. Maximum

#5
Posted by NoTiNGeM 11 Apr 2010 20:18
what is test #5? why did I have wa



var k,n,s,j,max:integer;
a:array [0..100000] of integer;
b:array [1..10] of integer;
begin
a[1]:=1;   a[0]:=0;
for k:=2 to 10000 do
begin
if k mod 2 =0 then a[k]:=a[k div 2] else
a[k]:=a[k div 2]+a[(k div 2)+1];
end;
k:=0;
while not eof do
begin
k:=k+1;
readln(b[k]);
end;
n:=k-1;
for k:=1 to n do
begin
max:=0;
s:=b[k];
for j:=1 to s do
begin
if a[j]>max then max:=a[j];
end;
writeln(max);
end;
end.
Re: #5
Posted by asenov.m 30 Sep 2010 22:42
Same problem here. It gives me crash on test 5. Maybe it's something to do with the case when the input consists of only one line  - 0 as it's not specified what the program should do then.
Re: #5
Posted by Andres 3 Oct 2010 06:19
Yep, same here.... crash using java on test 5.

GOT AC... error was when input was repeated e.g:
10000
10000
0

Answer:
521
521

My program was crashing because of using a set. GL

Edited by author 03.10.2010 06:24
Re: #5
where you find test cases?