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 |
第一次c++写,c++交。纪念一下#include <iostream> #include <stdio.h> using namespace std; int a[1000001]; int main() { int i,l,n,t,minn,maxx; scanf("%d",&t); while(t--){ scanf("%d %d",&l,&n); for(i=0;i<n;i++) scanf("%d",a+i); minn=maxx=0; for(i=0;i<n;i++) minn=max(minn,min(a[i],l-a[i])); for(i=0;i<n;i++) maxx=max(maxx,max(a[i],l-a[i])); printf("%d %d\n",minn,maxx); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator