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

why wrong answer??

Posted by hasan83 at 2007-09-22 00:51:34 on Problem 3250
#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:
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