WA!WA!WA!求大佬指正!!!!

P1464 Function

fanyuchen2010 @ 2023-02-25 21:13:24

#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
long long w[25][25][25];
int main(){
    for(int i=0;i<=20;i++)for(int j=0;j<=20;j++)for(int k=0;k<=20;k++)w[i][j][k]=1;
    for(int i=1;i<=20;i++)for(int j=1;j<=20;j++)for(int k=1;k<=20;k++)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];
    while(cin>>a>>b>>c&&!(a==-1&&b==-1&&c==-1)){
        cout<<"w("<<a<<", "<<b<<", "<<c<<") = ";
        if(a>20||b>20||c>20)cout<<w[20][20][20]<<endl;
        else if(a<=0||b<=0||c<=0)cout<<1;
        else cout<<w[a][b][c]<<endl;
    }
    return 0;
} 

by lxuyinc @ 2023-02-25 22:32:12

  if(a<=0||b<=0||c<=0)cout<<1;
else if(a>20||b>20||c>20)cout<<w[20][20][20]<<endl;
      //注意优先级

hack数据如下:

21 -21 20
-1 -1 -1

|