提交时间:2022-04-11 21:54:08
运行 ID: 48318
#include <bits/stdc++.h> using namespace std; inline int read(int x=0,bool f=1){ char c=getchar(); while(c>'9'||c<'0'){if(c=='-')f=0;c=getchar();} while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();} return f?x:-x; } int n,a[114514]; int main(){ n=read(); for(int i=1;i<=n;i++) a[i]=read(); printf("%d\n",(n&1)?max(a[1],a[n]):min(a[1],a[n])); return 0; }