#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
using namespace std;
int main()
{
int n;
double arr[12];
while (cin>>n&&n!=0)
{
for (int i=0;i<n;i++)
cin>>arr[i];
sort(arr,arr+n);
double high=1.0;
double xbefore=arr[0];
double xmid,yhigh;
for (int i=1;i<n;i++)
{
xmid=(arr[0]+arr[i])/2.0;
yhigh=sqrt(4.0-(xmid-xbefore)*(xmid-xbefore));
xbefore=xmid;
high+=yhigh;
}
printf("%.4lf %.4lf\n",xbefore,high);
}
return 0;
}
1012 Stacking Cylinders
最新推荐文章于 2017-06-30 18:47:00 发布