标签:oat mat tput name color lang sample 开始 for
Input
Output
Sample Input
3 72 30 50
Sample Output
120.000
#include<iostream>
#include<queue>
#include<math.h>
#include<stdio.h>
using namespace std;
int main()
{
int i,n;
float ans,x1,x2,k;
priority_queue<float,vector<float> >pq; / /最大优先队列列
cin >>n;
for (i=0;i<n;i++)
{
cin>>k;
pq.push(k);
}
while (pq.size()!=1) //从第二个开始这样定义
{ x1=pq.top();pq.pop();
x2=pq.top();pq.pop();
ans=2*sqrt(x1*x2);
pq.push(ans);
}
printf("%0.3f",pq.top());
return 0;
}
标签:oat mat tput name color lang sample 开始 for
原文地址:http://www.cnblogs.com/carry-2017/p/7220287.html