| ||||||||||
| 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 | |||||||||
G++WA?C++AC!最近已经遇到几次G++WA,C++AC这样的情况了,下面是小草的代码,哪位神牛能解释解释?
#include <cstdio>
#include <queue>
#include <cmath>
int main()
{
std::priority_queue <double> c;
int n;
double x , y;
scanf("%d",&n);
for(int i = 0;i<n;i++) { scanf("%lf",&x) ; c.push(x) ; }
while(1){
x = c.top() , c.pop();
if(c.empty()) { printf("%.3lf\n",x) ; break;}
y = c.top(), c.pop();
c.push(2*sqrt(x*y));
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator