结果一样 但是全wa expected .

P1464 Function

bf29__lj @ 2023-10-15 15:24:20

#include <cstdio>
#include <iostream>
#define MAXN 20
long long w[MAXN + 1][MAXN + 1][MAXN + 1];
long long x,y,z,t;

void thaha(){
    for(int i = 0;i <= MAXN;++i){
        for(int j = 0;j <= MAXN;++j){
            for(int k = 0;k <= MAXN;++k){
                if(i == 0 || j == 0 || k == 0){
                    w[i][j][k] = 1;
                }else if(i < j && j < k){
                    w[i][j][k] = w[i][j][k-1] + w[i][j-1][k-1] - w[i][j-1][k];
                }else{
                    w[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(){
    thaha();
    while(std::cin >> x >> y >> z){
        if(x == -1 && y == -1 && z == -1)break;
        if(x < 0 || y < 0 || z < 0)t = w[0][0][0];
        else if(x > 20 || y > 20 || z > 20)t = w[20][20][20];
        else t = w[x][y][z];
        printf("w(%lld,%lld,%ld) = %lld\n",x,y,z,t);
    }
    return 0;
}

by jqQt0220 @ 2023-10-15 15:26:45

printf("w(%lld,%lld,%ld) = %lld\n",x,y,z,t); 我不是很确定你的答案和样例一样


by jqQt0220 @ 2023-10-15 15:28:04

输出若干行,每一行格式:

w(a, b, c) = ans

注意空格。


by bf29__lj @ 2023-10-15 15:32:28

@jqQt0220 噢噢噢噢 逗号后面还有空格


by bf29__lj @ 2023-10-15 15:33:10

@jqQt0220 AC了 肥肠感谢


|