不知道这是不是HDU上面最水的一道题,直接附代码:
/*
ID:狂人
num:09073355
E-mail:wenboguo@live.com
*/
#include <vector>
#include <list>
#include <assert.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <fstream>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=b;--i)
#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define ALL(c) (c).begin(),(c).end()
#define debug(x) cerr<< #x << " = " << (x) << "\n";
#define debugv(v) cerr << #v << " = "; FOREACH(it,v) cerr << *it <<","; cerr << "\n";
#define SIZE(a) (int(a.size()))
#define mp make_pair
#define pb push_back
template<typename T> inline void checkMax(T& a, T b) {if (b>a) a=b;}
template<typename T> inline void checkMin(T& a, T b) {if (b<a) a=b;}
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> ii;
typedef pair<string, string>ss;
typedef long double ld;
const int INF = 0x7ffffff;
const int Maxl = 102;
//结构体内重载‘<’,使优先队列可以对其进行排序
struct Node{
string str1;
string str2;
Node(string st1, string st2):str1(st1),str2(st2){}
bool operator < (const Node &a) const
{
return a.str1 < str1;
}
};
int main(void)
{
bool hash[Maxl];
//ifstream cin ("aaa.txt");
int n;
cin >> n;
while (n--)
{
int m;
cin >> m;
memset(hash, false, sizeof(hash));
int st = INF, nd = INF;
while(m--)
{
int k;
cin >> k;
if (k < st)
{
nd = st;
st = k;
}
else if (k >= st && k <= nd)
{
nd = k;
}
else
continue;
}
cout << nd << endl;
}
//system("pause");
return 0;
}