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 1161. Stripies

Is this prog not correct?
Posted by Chadnov Roman 11 Mar 2002 14:42
var a:array[1..100] of longint;
    n,i,j:longint;
    max:extended;

begin
 readln(n);
 max:=0;
 for i:=1 to n do
   begin
     readln(a[i]);
     for j:=1 to i-1 do
      if sqrt(a[j]*a[i])>max then max:=sqrt(a[j]*a[i])
   end;
 writeln((max*2):0:2);
end.
Re: Is this prog not correct?
Posted by Avanesov 20 Mar 2002 20:34
No. Your program finds the maximal value of a[i]*a[j]. Your task is
different.

Let you have n numbers: a[1],...,a[n]. You can change any two numbers
a[i], a[j] with 2*sqrt(a[i],a[j]). So you've got another sequence : b
[1],...,b[n-1], where

b[1]=a[1];
...
b[i-1]=a[i-1];
b[i]=2*sqrt(a[i],a[j]);
b[i+1]=a[i+1];
...
b[j-1]=a[j-1];
b[j]=a[j+1];
...
b[n-1]=a[n].

Repeat procedure until you'll get the only integer.
You are to find the minimal value of this number.

Good luck!
Re: Is this prog not correct?
Posted by Votjakov Roman[Barnaul] 2 Dec 2005 11:41
Its solution is not correct!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!