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 |
输出用 %uIn Reply To:Why WA????? Posted by:BJ051155 at 2007-07-10 20:23:34 > #include <stdio.h> > unsigned long h[80001],num[80001]; > int id[80001]; > > int main(int argc, char* argv[]) > { > int n; > unsigned long total=0; > scanf("%d",&n); > for(int i=1;i<=n;i++) > scanf("%d",&h[i]); > id[n]=0; > for(i=n-1;i>=1;i--) > { > int j=i+1; > while(j&&h[j]<h[i]) > { > num[i]+=1; > num[i]+=num[j]; > j=id[j]; > } > id[i]=j; > total+=num[i]; > } > printf("%d\n",total); > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator