| ||||||||||
| 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 | |||||||||
1579这代码错在哪里,帮帮忙啊,总是Presentation Error#include<stdio.h>
int p[55][55][55];
int w(int i,int j,int k)
{
if(i<=0||j<=0||k<=0) return 1;
if(p[i][j][k]>0) return p[i][j][k];
if(i>20||j>20||k>20) p[i][j][k]=w(20,20,20);
if(i<j&&j<k) return p[i][j][k]=w(i,j,k-1)+w(i,j-1,k-1)-w(i,j-1,k);
else return p[i][j][k]=w(i-1,j,k)+w(i-1,j-1,k)+w(i-1,j,k-1)-w(i-1,j-1,k-1);
}
int main()
{
int a,b,s,c;
int i,j,k;
while(scanf("%d%d%d",&a,&b,&c)&&a!=-1||b!=-1||c!=-1)
{
for(i=0;i<a;i++)
for(j=0;j<b;j++)
for(k=0;k<c;k++)
if(i==0||j==0||k==0)
p[i][j][k]=-1;
s=w(a,b,c);
printf("w(%d,%d,%d) = %d\n",a,b,c,s);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator