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 mao19880106 at 2008-11-16 18:16:40 on Problem 3632
#include<iostream>
using namespace std;
void f(int data[],int m)
{
	int temp=data[0];
	int tt;
	for(int i=1;i<m;i++)
	{
		if(temp>data[i])
			temp=data[i];
	}
	for(int j=1;j<m;j++)
	{
		if(tt<data[j])
			tt=data[j];
	}
	cout<<(tt-temp)*2<<endl;
}
int main()
{
	int m;
	cin>>m;
	while(m--)
	{
		int n;
		int data[30];
		cin>>n;
		for(int i=0;i<n;i++)
		{
			cin>>data[i];
		}
		f(data,n);
	}
	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