1.题目描述:
愚人节快乐
3.解题思路:
藏头诗!!
find xor of largest and last array elements
------------------------------------------------------
找出最大的和最后一个异或值
4.AC代码:
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define maxn 100100
#define N 1111
#define eps 1e-6
#define pi acos(-1.0)
#define e exp(1.0)
using namespace std;
const int mod = 1e9 + 7;
typedef long long ll;
typedef unsigned long long ull;
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
long _begin_time = clock();
#endif
int n;
while (~scanf("%d", &n))
{
int last, largest = -1;
for (int i = 0; i < n; i++)
{
int x;
scanf("%d", &x);
largest = max(largest, x);
if (i == n - 1)
last = x;
}
printf("%d\n", largest ^ last);
}
#ifndef ONLINE_JUDGE
long _end_time = clock();
printf("time = %ld ms.", _end_time - _begin_time);
#endif
return 0;
}