为什么不能用三维数组扫过去?

P1464 Function

至少你的数组得开[21][21][21]啊
by Oliver2004 @ 2017-07-05 18:55:42


为什么要用三维呢??????????
by wangshuheng3541 @ 2017-07-18 21:23:17


```cpp #include<cstdio> #define ll long long using namespace std; ll w[21][21][21]; int main(){ for(int i=0;i<=20;++i) for(int j=0;j<=20;++j) w[i][j][0]=w[i][0][j]=w[0][i][j]=1; for(int i=1;i<=20;++i) for(int j=1;j<=20;++j) for(int k=1;k<=20;++k) 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]; ll a,b,c; while(scanf("%lld%lld%lld",&a,&b,&c)==3){ if(a==-1&&b==-1&&c==-1) break; if(a<=0||b<=0||c<=0) printf("w(%lld, %lld, %lld) = 1\n",a,b,c); else if(a>20||b>20||c>20) printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w[20][20][20]); else printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w[a][b][c]); } return 0; } ```
by CALXWMC @ 2017-08-03 13:16:52


|