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

Common Board

TO EVERYBODY: I will give any 2-6 AC-prorgrams of problems that I've solved to anybody who can give me AC-prorgrams of one(or more) of these problems:1065,1109,1111. My-email: nsc2001@rambler.ru
Posted by Nazarov Denis (nsc2001@rambler.ru) 7 Feb 2002 20:34
COME ONE, GUYS STOP DOING THIS! (+)
Posted by Michael_Rybak 7 Feb 2002 23:57
Can't you just ask for idea - not solution! I have solved each of
these problems, and I'll be glad to help you with any of them,
without asking anything in return! But program exchange is really
wierd and useless!
Sorry, I say not that I really want to say. Of course, I don't need code, I only need some hints(or main idea)
Posted by Nazarov Denis (nsc2001@rambler.ru) 8 Feb 2002 01:03
> Can't you just ask for idea - not solution! I have solved each of
> these problems, and I'll be glad to help you with any of them,
> without asking anything in return! But program exchange is really
> wierd and useless!
P.S. : Please, give me an idea of problem 1159 (My solution get WA)...(+)
Posted by Nazarov Denis (nsc2001@rambler.ru) 8 Feb 2002 01:07
..Or find test where my program failed.

Program t1159;{$N+}

Const MaxN   = 100;
      Change = 180/Pi;
      OkW    = 360.0;
      Eps    = 1E-15;
      Eps2   = 1E-1;

Var   Block        : array[1..MaxN]of integer;
      N,i,sum,max  : integer;
      mx,t         : integer;
      left,rigth   : extended;
      middle,pk    : extended;
      curW,p       : extended;
      ok           : boolean;
      label          AAA;

Function GetLW(R : extended;L : integer) : extended;
Var cosw,w,tgw  : extended;
 begin
  cosw:=(2*R*R-L*L)/(2*R*R);
  if cosw=0 then w:=90 else begin
    tgw:=sqrt(1-cosw*cosw)/cosw;
    w:=ArcTan(tgw)*Change;
    if w<0 then w:=180+w;
   end;
  GetLW:=w;
 end;

Function GetW(R : extended) : extended;
Var w     : extended;
    j     : integer;
 begin
  w:=0;
  for j:=1 to N do w:=w+GetLW(R,Block[j]);
  GetW:=w;
 end;

Function GetS(R : extended) : extended;
Var Ans,p,S  : extended;
    i        : integer;
 begin
  Ans:=0;
  for i:=1 to N do begin
    p:=(2*R+Block[i])/2;
    S:=sqrt(abs(p*(p-R)*(p-R)*(p-Block[i])));
    Ans:=Ans+S;
   end;
  GetS:=Ans;
 end;

Procedure WriteAns(R : extended);
 begin
  Writeln(GetS(R):0:2);
  Halt(0);
 end;

Procedure WriteAns2(R : extended);
Var S,p  : extended;
 begin
  p:=(R+R+Block[N+1])/2;
  S:=sqrt(p*(p-R)*(p-R)*(p-Block[N+1]));
  Writeln(GetS(R)-S:0:2);
  Halt(0);
 end;

begin
 Read(N);
 sum:=0;
 max:=0;
 for i:=1 to N do Read(Block[i]);
 for i:=1 to N do begin
   sum:=sum+Block[i];
   if Block[i]>max then begin
    max:=Block[i];
    mx:=i;
   end;
  end;
 if mx<>N then begin
   t:=Block[mx];
   Block[mx]:=Block[N];
   Block[N]:=t;
  end;
 if max>=sum-max then begin
   Block[N]:=1;
   Writeln('0.00');
   Halt(0);
  end;
 pk:=max/2;
 left:=pk;
 rigth:=sum;
 While True do begin
   middle:=(left+rigth)/2;
   curW:=GetW(middle);
   if curW<OkW then rigth:=middle else left:=middle;
   if rigth-left<Eps then break;
  end;
 if abs(curW-OkW)<Eps2 then WriteAns(middle);
 N:=N-1;
 left:=pk;
 rigth:=1E10;
 While True do begin
   middle:=(left+rigth)/2;
   curW:=GetW(middle);
   if curW>GetLW(middle,Block[N+1]) then rigth:=middle else
left:=middle;
   if rigth-left<Eps then break;
  end;
 if abs(GetW(middle)-GetLW(middle,Block[N+1]))<Eps2 then writeans2
(middle);
end.
A test for you (+)
Posted by Michael_Rybak 8 Feb 2002 18:07
Try this test case:
4
1
2
3
5
The correct answer is 4.44

Good luck!
Thank you very much for your help !!! I get AC. As you can see I changed only 2 bytes of my code! Thank YOU!!!!!!!
Posted by Nazarov Denis (nsc2001@rambler.ru) 8 Feb 2002 20:43
> Try this test case:
> 4
> 1
> 2
> 3
> 5
> The correct answer is 4.44
>
> Good luck!