coder_1746 @ 2022-06-01 21:29:04
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll x,y,z,A[500];
int 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(a<b && b<c) return w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
else return 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(){
for(;;){
cin>>x>>y>>z;
if(x==y==z==-1) break;
else cout<<"w("<<x<<","<<y<<","<<z<<") = " <<w(x,y,z)<<endl;
}
return 0;
}
本蒟蒻怀疑点:
1、for(;;)
是不是没停下来,没有break,导致T掉?
2、是不是数据太大,函数这里出了问题T掉?
P.S.本蒟蒻不会记忆化搜索,本体能做吗...
by coder_1746 @ 2022-06-01 21:40:03
@zzrzyn azzz,上次月赛只拿了20分yyy
by coder_1746 @ 2022-06-01 21:40:26
@Hughzhuxiuqi 有点道理!
by zzr1 @ 2022-06-01 21:40:34
@coder_1746 这次肯定不会了
by coder_1746 @ 2022-06-01 21:41:33
@zzrzyn 啊原来你是出题人啊,我才发现(bushi)
by happybob @ 2022-06-01 21:46:01
@coder_1746 不会记忆化搜索应该做不了了
by Coros_Trusds @ 2022-06-02 06:27:03
@coder_1746 显然不能这么用啊 if(x==y==z==-1) break;
by Coros_Trusds @ 2022-06-02 06:30:30
另外输出也不对
by coder_1746 @ 2022-06-02 07:27:48
@Coros_Trusds 感谢!
by nannuke @ 2022-07-09 18:18:56
停不下来不会TLE吧,因该是RE吧