标签:
2
5
2 3.2 4 4.5 6
10
1 2 3 1 2 1.2 3 1.1 1 2
2
5
1 #include<stdio.h> 2 #include<math.h> 3 #define N 600 4 float a[N]; 5 6 int main( ) { 7 int m, sum, i, j; 8 float temp, l; 9 scanf("%d", &m); 10 while(m--) { 11 int n; 12 scanf("%d", &n); 13 for(i = 0; i < n; i ++) 14 scanf("%f", &a[i]); 15 for(i = 0; i < n; i ++) //从小到大排序(冒泡排序) 16 for(j = i + 1; j < n;j ++) 17 if(a[i] > a[j]) { 18 temp = a[i]; 19 a[i] = a[j]; 20 a[j] = temp; 21 } 22 l = 20; 23 sum = 0; 24 for(i = n - 1; l >= 0; i--) { 25 l = l - 2 * sqrt(a[i] * a[i] - 1); 26 sum ++; 27 } 28 printf("%d\n", sum); 29 } 30 return 0; 31 }
标签:
原文地址:http://www.cnblogs.com/tong69/p/5798771.html