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

顶!!

Posted by ecjtubaowp at 2007-08-04 15:42:59 on Problem 1285
In Reply To:what's wrong with my code??? Posted by:ecjtubaowp at 2007-08-04 10:30:59
> #include<stdio.h>
> #include<string.h>
>  __int64 TN[51],f[1000],d[1000],T[52];
> int main()
> {
>  int i,j,k,m,n,s,g,a[52];
>  int A,B,S;
>  int t=1;
>  while(1)
>  {
>   scanf("%d%d",&n,&m);
>   if(n==0&&m==0)break;
>   memset(TN,0,sizeof(TN));
>   memset(f,0,sizeof(f));
>   memset(d,0,sizeof(d));
>  for(i=1;i<=n;i++){scanf("%d",&k);TN[k]++;}
>  for(i=1;i<=m;i++)scanf("%d",&a[i]);
>  k=0;
>  for(i=1;i<=n;i++)
>  if(TN[i]){k++;T[k]=TN[i];}
>  //for(i=1;i<=k;i++)
>  //printf("%d\n",T[i]);
>   for(s=0;s<=T[1];s++)
>   {
>    for(g=0;g<=T[2];g++)
>    f[s+g]++;
>   }
>   
>   T[1]=T[1]+T[2];
>   //for(s=0;s<=TN[1];s++)
>   //printf("%d\n",f[s]);
>   for(i=3;i<=k;i++)
>   {
>    for(s=0;s<=T[1];s++)
>    {
>     for(g=0;g<=T[i];g++)
>     d[s+g]+=f[s];
>    }
>    T[1]+=T[i];
>    for(j=0;j<=1000;j++){f[j]=d[j];d[j]=0;}
>   }
>   //for(s=0;s<=TN[1];s++)
>   //printf("%d\n",d[s]);
>   printf("Case %d:\n",t++);
>   for(i=1;i<=m;i++)
>   printf("%I64d\n",f[a[i]]);
>  }
>  
> }

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