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

在vc下正确运行,在这却wrong answer,是为什么啊

Posted by finalhope at 2013-03-21 11:15:11 on Problem 1579

#include <stdio.h>

int arr[21][21][21];




int main()
{
	int a;
	int b;
	int c;
	 int i,j,k;
     for(i=0;i<21;i++)
     {
        for(j=0;j<21;j++)
        { 
            arr[0][i][j]=1;
            arr[i][0][j]=1;
            arr[i][j][0]=1;
        }
     }
     for(i=1;i<21;i++)
     {
         for(j=1;j<21;j++)
         {
             for(k=1;k<21;k++)
             {
               if(i<j&&j<k)
               arr[i][j][k]=arr[i][j][k-1]+arr[i][j-1][k-1]-arr[i][j-1][k];
               else
 arr[i][j][k]=arr[i-1][j][k]+arr[i-1][j-1][k]+arr[i-1][j][k-1]-arr[i-1][j-1][k-1];
             }
         }
     }
    while(scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
         if(a==-1&&b==-1&&c==-1)break;
         if(a<=0||b<=0||c<=0)printf("W(%d, %d, %d) = %d\n",a,b,c,1);
         else  if(a>=20||b>=20||c>=20)printf("W(%d, %d, %d) = %d\n",a,b,c,arr[20][20][20]);
         else printf("W(%d, %d, %d) = %d\n",a,b,c,arr[a][b][c]);

    }
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