Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这数据太变态了#include<cstdio> int max(int a,int b) { if (a>b) return a; else return b; } int min(int a,int b) { if (a<b) return a; else return b; } int l,n; int x[1000000]; void solve() { int mint=0,maxt=0; for (int i=0;i<n;i++) { mint=max(mint,min(x[i],l-x[i])); maxt=max(maxt,max(x[i],l-x[i])); } printf("%d %d\n",mint,maxt); } int main() { int k; scanf("%d",&k); for (int i=1;i<=k;i++) { scanf("%d%d",&l,&n); for (int j=0;j<n;j++) scanf("%d",&x[j]); solve(); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator