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 wa

Posted by superman2006 at 2007-08-04 01:10:14 on Problem 3046
#include<stdio.h>
__int64 TN[1001],f[100010],d[100010];
int main()
{
 int i,j,k,m,n,s,g;
 int T,A,B,S;
 scanf("%d%d%d%d",&T,&A,&S,&B);
 
 for(i=1;i<=A;i++){scanf("%d",&k);TN[k]++;}
 //for(i=1;i<=T;i++)
 //printf("%d\n",TN[i]);
  for(s=0;s<=TN[1];s++)
  {
   for(g=0;g<=TN[2];g++)
   f[s+g]++;
  }
  
  TN[1]=TN[1]+TN[2];
  //for(s=0;s<=TN[1];s++)
  //printf("%d\n",f[s]);
  for(i=3;i<=T;i++)
  {
   for(s=0;s<=TN[1];s++)
   {
    for(g=0;g<=TN[i];g++)
    d[s+g]+=f[s];
   }
   TN[1]+=TN[i];
   for(j=0;j<=TN[1];j++){f[j]=d[j];d[j]=0;}
  }
  //for(s=0;s<=TN[1];s++)
  //printf("%d\n",d[s]);
  __int64 sum=0;
  for(i=S;i<=B;i++)
  sum+=f[i];
  printf("%I64d\n",sum);
 while(1);
 
}

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