Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

第一次来POJ,《挑战》上找的题,竟然败在了初始化MIN和MAX上

Posted by 547263741 at 2017-04-30 17:32:26 on Problem 1852
#include<stdio.h>

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 main()
{
    int t,i,j,L,n,x,max=0,min=0;
    scanf("%d",&t);
    for(j=1;j<=t;j++)
	{
	max=0;min=0;
	scanf("%d %d",&L,&n);
	for(i=0;i<n;i++)
	{	scanf("%d",&x);
 max=_max(max,_max(x,L-x));
 min=_max(min,_min(x,L-x));

	}
	printf("%d %d\n",min,max);
	
 } }


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator