论为什么错?

P1464 Function

希望更丰富的展现?使用MD
by lew2018 @ 2019-07-23 21:59:45


@[lew_2018](/space/show?uid=82965) DM是什么??
by 奥力给 @ 2019-07-23 22:02:10


@[sususum](/space/show?uid=60807) 希望更丰富的展现?使用Markdown
by RainFestival @ 2019-07-23 22:03:30


@[zhouxiaobao](/space/show?uid=36957) 莫子意思?
by 奥力给 @ 2019-07-23 22:04:52



by 奥力给 @ 2019-07-23 22:05:16


@[zhouxiaobao](/space/show?uid=36957) 格式对吧
by 奥力给 @ 2019-07-23 22:05:56


帮你MD好了: ```cpp // luogu-judger-enable-o2 #include<bits/stdc++.h> using namespace std; long long aa[25][25][25]={0}; int w(int a,int b,int c){ if(a <= 0 || b<= 0 || c <= 0) return 1; if(aa[a][b][c] != 0) return aa[a][b][c]; if(a > 20 || b > 20 || c > 20) return w(20,20,20); aa[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); return aa[a][b][c]; } int main(){ long long a,b,c; while(1){ cin>>a>>b>>c; if(a==-1 && b==-1 && c==-1) return 0; else if(a <= 0 || b<=0 || c<=0) cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<w(a,b,c)<<endl; else if(a > 20 || b > 20 || c > 20) {cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<w(20,20,20)<<endl;} else cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<w(a,b,c)<<endl; } return 0; }
by Happy_Dream @ 2019-07-23 22:06:24


#include<bits/stdc++.h> using namespace std; long long aa[25][25][25]={0}; int w(int a,int b,int c){ if(a <= 0 || b<= 0 || c <= 0) return 1; if(aa[a][b][c] != 0) return aa[a][b][c]; if(a > 20 || b > 20 || c > 20) return w(20,20,20); aa[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); return aa[a][b][c]; } int main(){ long long a,b,c; while(1){ cin>>a>>b>>c; if(a==-1 && b==-1 && c==-1) return 0; else if(a <= 0 || b<=0 || c<=0) cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<w(a,b,c)<<endl; else if(a > 20 || b > 20 || c > 20) {cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<w(20,20,20)<<endl;} else cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<w(a,b,c)<<endl; } return 0; }
by 奥力给 @ 2019-07-23 22:06:45


@[yisu](/space/show?uid=127707) 为什么你的步伐与我如此相同 你是魔鬼还是秀儿
by 奥力给 @ 2019-07-23 22:08:03


MY AC Code ```cpp #include <bits/stdc++.h> #define ll long long using namespace std; ll dp[25][25][25]; ll f(ll a,ll b,ll c) { if(a<=0||b<=0||c<=0) return 1; if(a>20||b>20||c>20) return f(20,20,20); if(dp[a][b][c]>=0) return dp[a][b][c]; if(a<b&&b<c) return dp[a][b][c]=f(a,b,c-1)+f(a,b-1,c-1)-f(a,b-1,c); return dp[a][b][c]=f(a-1,b,c)+f(a-1,b-1,c)+f(a-1,b,c-1)-f(a-1,b-1,c-1); } int main() { ll a,b,c; memset(dp,-1,sizeof(dp)); while(cin>>a>>b>>c) { if(a==-1&&b==-1&&c==-1) return 0; printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,f(a,b,c)); } returm 0;//haha }
by Happy_Dream @ 2019-07-23 22:08:57


| 下一页