Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

G++WA?C++AC!

Posted by songxuehui at 2009-10-05 21:28:12 on Problem 1862
最近已经遇到几次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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator