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

再水不过如此,20分钟一A水过。。。附代码

Posted by 058179 at 2013-04-19 23:42:58 on Problem 1862
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
#define MAX 101

double weight[MAX];
int n;
bool cmp(int a, int b) { return a > b; }

int main()
{
	scanf("%d", &n);
	int i;
	for(i = 0; i < n; i ++) scanf("%lf", &weight[i]);
	
	for(i = 0; i < n - 1; i ++)
	{
		sort(weight + i, weight + n, cmp);
		weight[i + 1] = 2 * sqrt(double(weight[i] * weight[i + 1]));
	}
	printf("%.3lf\n", weight[n - 1]);
}

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