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 1184. Cable Master

Could anyone help me?(+)
Posted by shitty.Mishka 30 Mar 2002 12:32
What could be wrong with this code?

Program Easy;
Const Max=10006;
Var i,n,k:Longint;
a:Array[1..Max] Of Longint;
x,y,z:Longint;
u,q:Real;
Function ok(l:Longint):Boolean;
Var i,s:Longint;
Begin
s:=0;
For i:=1 To n Do
s:=s+a[i] Div l;
ok:=s>=k;
End;
Begin
{ Assign(Input,'1184.in'); Reset(input);{}
y:=10000000;
For i:=1 To n Do Begin
a[i]:=Round(u*100);
End;
x:=1;
If Not ok(x) Then Begin
Writeln('0.00');
Halt;
End;
While y-x>1 Do Begin
z:=(y+x) Div 2;
If ok(z) Then
x:=z
Else
y:=z;
End;
While Not ok(z) Do
z:=z-1;
While Ok(z+1) Do
z:=z+1;
q:=z;
q:=q/100;
Writeln(q:0:2);
End.
Thank you for your help, H J ! (-)
Posted by shitty.Mishka 30 Mar 2002 15:28