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

Re:还有我这个,why wa?

Posted by pxwanfeng at 2005-09-27 19:37:28 on Problem 1769
In Reply To:还有我这个,why wa? Posted by:mostleg at 2005-08-18 15:18:35
>  
> #include <stdio.h>
> #include <string.h>
> 
> #define MAX 50002
> 
> long a[MAX];
> 
> int main()
> {
> 	long i,j,k;
> 	long n,m;
> 	long tot;
> 	long x,y;
> 	
> 		memset(a,0,sizeof(a));
> 		scanf("%ld %ld",&n,&m);
> 		for (i=1;i<=m;i++)
> 		{
> 			scanf("%ld %ld",&x,&y);
> 			if (a[x]<y)
> 				a[x]=y;
> 		}
> 
> 		i=1;
> 		tot=0;
> 		k=a[1];
> 		do
> 		{
> 			tot++;
> 			if (k>=n)
> 				break;
> 
> 			j=k;
> 			while (i<=k)
> 			{
> 				if (a[i]>j)
> 					j=a[i];
> 				i++;
> 			}
> 			k=j;
> 
> 		}while (1);
> 
> 
> 		printf("%ld\n",tot);
> 	return 0;
> }
> 

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