标签:style blog io color os sp for on 数据
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的都满足题意;即已中心轴(从(height/2)对折)作圆)为圆心的移动路径;
所以有效长度为2*sqrt(r*r-(height/2)*(height/2)!!!
代码为:
#include<iostream> #include<math.h> using namespace std; #define N 100 int main() { float a[N], key; int n,m; float wide ,height; int i,j,count; cin>>m; while(m--) { height=2; wide=20; count=0; cin>>n; for(i=0;i<n;i++) cin>>a[i]; for(i=1;i<n;i++) { key=a[i]; j=i-1; while(a[j]>key&&j>=0) { a[j+1]=a[j]; j--; } a[j+1]=key; } for(i=n-1;i>=0,wide>=0;i--) { wide=wide-2*sqrt(a[i]*a[i]-(height/2)*(height/2)); count++; } cout<<count; // cout<<endl; } return 0; }
标签:style blog io color os sp for on 数据
原文地址:http://www.cnblogs.com/yaobolove/p/4152780.html