标签:
算是一道比较简单的数学题了~
1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 double a[1005]; 6 7 int main() 8 { 9 int n, t; 10 scanf("%d", &t); 11 int k=1; 12 while(t--) 13 { 14 scanf("%d", &n); 15 for(int i=0; i<n; i++) 16 scanf("%lf", &a[i]); 17 sort(a, a+n); 18 double x = (a[0] + a[n-1]) / 2; 19 double y=1; 20 for(int i=0; i<n-1; i++) 21 y += sqrt(4 - pow((a[i+1]-a[i])/2, 2)); 22 printf("%d: ", k++); 23 printf("%.4lf %.4lf\n", x, y); 24 } 25 26 return 0; 27 }
sicily 1206 Stacking Cylinders
标签:
原文地址:http://www.cnblogs.com/dominjune/p/4569900.html