蒟蒻0分全WA求调,玄关

P1464 Function

@[qhcKing](/user/775011) ```cpp #include <bits/stdc++.h> using namespace std; #define ll long long ll rem[21][21][21]; bool vis[21][21][21]; ll w(ll a,ll b,ll c){ if(a<=0||b<=0||c<=0) return 1; if(a>20||b>20||c>20) return w(20,20,20); if(vis[a][b][c]) return rem[a][b][c]; if(a<b&&b<c) rem[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c); else rem[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); vis[a][b][c]=1; return rem[a][b][c]; } int main(){ while(1){ ll a,b,c; cin>>a>>b>>c; if(a==-1&&b==-1&&c==-1) break; cout<<"w("<<a<<", "<<b<<", "<<c<<')'<<" = "<<w(a,b,c)<<endl; } return 0; } ``` 式子写错了。看了挺久。
by Faith_toChange @ 2024-08-04 17:02:48


@[Faith_toChange](/user/374769) 已AC,感谢大佬,已关
by qhcKing @ 2024-08-04 17:23:37


|