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 |
还有我这个,why wa?In Reply To:why wa? Posted by:bailey at 2005-08-18 14:10:34 #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator