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> 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