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 |
Re:Why,WA?In Reply To:Why,WA? Posted by:Alexande at 2006-05-24 19:56:45 > #include <stdio.h> > #define max 22 > int data[max][max][max]; > void main() > { > > int i,j,k; > for(i=0;i<21;i++) > for(j=0;j<21;j++) > { > data[0][i][j]=1; > data[i][0][j]=1; > data[i][j][0]=1; > } > for(i=1;i<=20;i++) > for(j=1;j<=20;j++) > for(k=1;k<=20;k++) > { > if((i<j)&&(j<k)) > data[i][j][k]=data[i][j][k-1] + data[i][j-1][k-1] - data[i][j-1][k]; > else > data[i][j][k]=data[i-1][j][k] + data[i-1][j-1][k] + data[i-1][j][k-1] -data[i-1][j-1][k-1]; > } > int a,b,c; > while(1) > { > scanf("%d %d %d",&a,&b,&c); > if((a==-1)&&(b==-1)&&(c==-1)) > break; > printf("w(%d, %d, %d) = ",a,b,c); > if(a>20||b>20||c>20) > printf("%d\n",data[20][20][20]); > else if(a<=0||b<=0||c<=0) > printf("1\n"); > else > printf("%d\n",data[a][b][c]); > } > > > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator