|  | 
|  | 
| вернуться в форум | #5 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 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 Послано Andres  3 окт 2010 06:19Yep, 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? | 
 | 
|