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 |
5891MS 过!玩星际2去!!!#include <iostream> #define MAXN 50005 int v[MAXN]; int main() { freopen("c:/a.txt","r",stdin); int n,i,j,res,maxv; while(scanf("%d",&n)!=EOF) { res=-1; for(i=0;i<n;i++) scanf("%d",&v[i]); for(i=0;i<n;i++) { maxv=v[i]; for(j=i+1;j<n;j++) if(v[j]<=v[i]) break; else if(v[j]>maxv) { maxv=v[j]; res=res>(j-i)?res:(j-i); } } printf("%d\n",res); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator