标签:style blog io color sp for div log bs
1 /* 2 PROBLEM:poj1852 3 AUTHER:Nicole 4 MEMO:水题 5 */ 6 #include<cstdio> 7 using namespace std; 8 int cmax(int a,int b){return a>b?a:b;} 9 int cmin(int a,int b){return a<b?a:b;} 10 int main() 11 { 12 int cases; 13 scanf("%d",&cases); 14 for (int c=1;c<=cases;c++) 15 { 16 int l,n; 17 int mmax=0,mmin=0; 18 scanf("%d%d",&l,&n); 19 for (int i=1;i<=n;i++) 20 { 21 int x; 22 scanf("%d",&x); 23 mmax=cmax(mmax,cmax(x,l-x)); 24 mmin=cmax(mmin,cmin(x,l-x)); 25 } 26 printf("%d %d\n",mmin,mmax); 27 } 28 return 0; 29 }
标签:style blog io color sp for div log bs
原文地址:http://www.cnblogs.com/NicoleLam/p/4088656.html