| ||||||||||
| 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 | |||||||||
Re:tt没赋值In Reply To:各位大哥!!!帮小弟看看呗!!! Posted by:mao19880106 at 2008-11-16 18:16:40 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator