蒟蒻求调 全WA

P1464 Function

AniuKarry @ 2022-08-03 15:11:54

#include <bits/stdc++.h>
using namespace std;
long long ans[21][21][21];
int w(int a,int b,int c)
{
    if(a<=0||b<=0||c<=0) return 1;
    if(a>20||b>20||c<=0) return w(20,20,20);
    if(ans[a][b][c]!=0) return ans[a][b][c];
    if(b>a&&c>b) return ans[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
    return ans[a][b][c]=w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1);
}
int main()
{
    while(1)
    {
        long long a,b,c;
        cin>>a>>b>>c;
        if(a!=-1&&c!=-1&&b!=-1)
        cout<<"W("<<a<<", "<<b<<", "<<c<<") = "<<w(a,b,c); 
        else 
        break;
    }
    return 0;
}

by ssilrrr @ 2022-08-03 15:40:23

你的右括号是中文的(


by GAOSY @ 2022-08-14 18:37:15

cout<<endl;


|