|
|
Edited by author 19.01.2007 23:15 The sample input for Stripies (# 1161) would be right if it were 4 72 30 50 30 giving same output 120 Is that right? Yes, that's right, but the sample input in also correct. ;) 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. 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! Its solution is not correct!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! My program gets wrong answer when only 2 digits after the decimal place are printed, but accepted when 3 digits after the decimal place are printed. I suspect the person who submitted this problem did not change the output files from the contest - those output files contain 3 digits after the decimal place! Admins please check. Thanks. Yes, there was a problem with testing program. Fixed. Thank you for your feedback. |
|
|