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

Re:我的 c, 简单哦^_^

Posted by qiyx at 2008-04-01 22:51:27 on Problem 1862
In Reply To:我的 c, 简单哦^_^ Posted by:gardner at 2005-10-12 02:01:13
> #include <stdio.h>
> #include <math.h>
> void main()
> {
> 	int num,i,j;
> 	double temp;
> 	double input[101]={0};
> 	scanf("%d",&num);
> 	for(i=0;i<num;i++)scanf("%lf",&input[i]);
> 	if(num==1)printf("%.3lf\n",input[0]);
> 	else {
> 		for(i=0;i<num;i++){
> 			for(j=num-2;j>=i;j--)if(input[j]>input[j+1]){
> 				temp=input[j];
> 				input[j]=input[j+1];
> 				input[j+1]=temp;
> 			}
> 		}
> 		for(i=num-2;i>=0;i--){
> 			input[i]=2*sqrt(input[i]*input[i+1]);
> 		}
> 		printf("%.3lf\n",input[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