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 wrong answer??#include<stdio.h> int c[80000]; int main() { __int64 sum=0; int a[80000],n; scanf("%d",&n); for(int i=0;i<n;i++)scanf("%d",&a[i]); for(int i=n-2;i>=0;i--) { int j=i+1; while(j<n&&a[i]>=a[j]) { c[i]+=c[j]+1; j+=c[j]+1; } sum+=c[i]; } printf("%d\n",sum); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator