| ||||||||||
| 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<stdio.h>
int getnum() //读大量数据特别快
{
char ch;
while (ch=getchar(),ch==10||ch==32);
int ans=ch-48;
while ((ch=getchar())!=EOF&&(ch>='0'&&ch<='9'))
{
ans*=10;
ans+=ch-'0';
}
return ans;
}
int main()
{
int min1,max1,min,max,i,j,m,l,n,x;
scanf("%d",&m);
while (m--) {
scanf("%d%d",&l,&n);
max=min=0;
for (j=0;j<n;j++) {
x=getnum();
if(x<l-x) {min1=x;max1=l-x;}
else {min1=l-x;max1=x;}
min>?=min1;
max>?=max1;
}
printf("%d %d\n",min,max);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator