怎么回事啊

编译通过...

├ 测试数据 01:答案错误... ├ 标准行输出 w(0, 0...

 ├ 错误行输出 w(-1,-...

——————————————————————————

var

a:array[0..21,0..21,0..21] of longint;

i,j,k,x,y,z:longint;

function f(x,y,z:longint):longint;

begin

if (x20) then exit(a[20,20,20]);

exit(a[x,y,z]);

end;

begin

fillchar(a,sizeof(a),0);

for i:=0 to 21 do

for j:=0 to 21 do

for k:=0 to 21 do

if i*j*k=0 then a:=1;

for i:=1 to 20 do

for j:=1 to 20 do

for k:=1 to 20 do {if a=0 then}

if (i

3 条评论

  • @ 2015-07-31 14:48:34

    #include<cstdio>
    #include<cstring>
    #include<iostream>
    using namespace std;
    int s[21][21][21];
    bool v[21][21][21];
    int a1,b1,c1;
    int dfs(int a,int b,int c)
    {
    int ans=0;
    if(v[a][b][c]==true)
    {
    return s[a][b][c];
    }
    else if(a<=0||b<=0||c<=0)return 1;
    else if(a>20||b>20||c>20)ans=dfs(20,20,20);
    else if(a<b&&b<c)ans=dfs(a,b,c-1)+dfs(a,b-1,c-1)-dfs(a,b-1,c);
    else ans=dfs(a-1,b,c)+dfs(a-1,b-1,c)+dfs(a-1,b,c-1)-dfs(a-1,b-1,c-1);
    v[a][b][c]=true;
    s[a][b][c]=ans;
    return ans;
    }
    int main()
    {
    while(scanf("%d%d%d",&a1,&b1,&c1)!=EOF)
    {
    if(a1==-1&&b1==-1&&c1==-1)return 0;
    printf("w(%d, %d, %d) = %d",a1,b1,c1,dfs(a1,b1,c1));
    }
    return 0;
    }

  • @ 2015-07-31 14:46:46

    #include<cstdio>
    #include<cstring>
    #include<iostream>
    using namespace std;
    int s[21][21][21];
    bool v[21][21][21];
    int a1,b1,c1,ans=0;
    int dfs(int a,int b,int c)
    {
    if(v[a][b][c]==true)
    {
    return s[a][b][c];
    }
    else if(a<=0||b<=0||c<=0)return 1;
    else if(a>20||b>20||c>20)ans=dfs(20,20,20);
    else if(a<b&&b<c)ans=dfs(a,b,c-1)+dfs(a,b-1,c-1)-dfs(a,b-1,c);
    else ans=dfs(a-1,b,c)+dfs(a-1,b-1,c)+dfs(a-1,b,c-1)-dfs(a-1,b-1,c-1);
    v[a][b][c]=true;
    s[a][b][c]=ans;
    return ans;
    }
    int main()
    {
    while(scanf("%d%d%d",&a1,&b1,&c1)!=EOF)
    {
    if(a1==-1&&b1==-1&&c1==-1)return 0;
    printf("w(%d, %d, %d) = %d",a1,b1,c1,dfs(a1,b1,c1));
    }
    return 0;
    }

  • @ 2012-07-24 19:01:21

    谁帮我看一下啊

    自己测试没有问题啊。。

  • 1

信息

ID
1080
难度
6
分类
搜索 | 搜索与剪枝 点击显示
标签
(无)
递交数
3788
已通过
1131
通过率
30%
被复制
7
上传者