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 |
何错之有#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator