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

何错之有

Posted by zengjinlong at 2007-11-03 09:47:44 on Problem 1862
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int N;
    cin>>N;
    cout.setf(ios::fixed);
    cout.precision(3);
    if(N==1){double  x; cin>>x; cout<<x<<endl;}
    else{
    int *a=new int[N];
    for(int i=0;i<N;i++)
    cin>>a[i];
    for(int i=0;i<N-1;i++)
    {int flag=0;
        for(int j=0;j<N-i-1;j++)
         if(a[j]>a[j+1]){int t=a[j];a[j]=a[j+1];a[j+1]=t;flag=1;}
         if(flag==0)break;
      }
      cout<<2*sqrt(a[N-2]*a[N-1]*1.0)<<endl;}
  system("pause");
  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