Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
于是我选择使用iostream,haha~~~In Reply To:G++ WA C++ AC的同学请注意%lf需要g++4.8才支持 Posted by:tianyichen at 2016-01-13 15:11:18 #include<queue> #include<cmath> #include<cstdio> #include<cstdlib> #include<iomanip> #include<iostream> #include<algorithm> using namespace std; priority_queue<double>pq; signed main(void) { ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0, w; i < n; i++) cin>>w, pq.push((double)w); while (pq.size() > 1) { double top1 = pq.top(); pq.pop(); double top2 = pq.top(); pq.pop(); pq.push(2 * sqrt(top1*top2)); } cout << fixed << setprecision(3) << pq.top() << endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator