I want some help in this problem
http://uva.onlinejudge.org/index.php?op ... ID+7648769
I don't know what's the problem in my code but really i do my best but UVA still sending to me WA


This is my code:
Code: Select all
#include<iostream>
using namespace std;
int main()
{
int T,n,x[100];
int min ;
int max ;
int arr1[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int arr2[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
cin >> T;
if(T >= 1 && T <= 100)
{
for(int i=0;i<T;i++)
{
min =100000;
max = -1;
cin >> n;
if(n >= 1 && n <= 20)
{
for(int j=0;j<n;j++)
{
cin >> x[j];
if(x[j] >= 0 && x[j] <= 99)
{
continue;
}
else
break;
}
for(int k =0;k<n;k++)
{
if(x[k] < min)
{
arr1[i] = min = x[k];
}
else if(x[k] > max)
{
arr2[i] = max = x[k];
}
}
}
}
if(n>1)
{
for(int i=0;i<T;i++)
{
cout << (arr2[i] - arr1[i])*2 << endl;
}
}
else if(n == 1)
cout << "0" << endl;
}
return 0;
}
