OJ-Problems-Source/HDOJ/2561_autoAC.cpp
2016-08-22 00:30:27 +08:00

33 lines
641 B
C++

#include<stdio.h>
int main ()
{
int min, temp;
int t, n, a;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
scanf("%d", &min);
scanf("%d", &temp);
if(min > temp)
{
min += temp;
temp = min - temp;
min = min -temp;
}
for(n -= 2; n; n--)
{
scanf("%d",&a);
if(a <= min)
{
temp = min;
min = a;
}
else if(a < temp)
temp = a;
}
printf("%d\n", temp);
}
return 0;
}