HC_Lin @ 2022-08-26 21:20:44
#include<iostream>
using namespace std;
int ia[99999999999];
int ib[99999999999];
int ic[99999999999];
int ans[99999999999];
int i=1;
int w(int a,int b,int c){
if(a<=0||b<=0||c<=0){
ia[i]=a;
ib[i]=b;
ic[i]=c;
ans[i]=1;
i++;
return 0;
}
else if(a>20||b>20||c>20){
w(20,20,20);
i++;
return 0;
}
else if(a<b&&b<c){
int d=w(a,b,c-1);
int e=w(a,b-1,c-1);
int f=w(a,b-1,c);
int g=d+e-f;
ia[i]=a;
ib[i]=b;
ic[i]=c;
ans[i]=g;
i++;
return 0;
}
int d=w(a-1,b,c);
int e=w(a-1,b-1,c);
int f=w(a-1,b,c-1);
int g=w(a-1,b-1,c-1);
int h=d+e+f-g;
ia[i]=a;
ib[i]=b;
ic[i]=c;
ans[i]=h;
i++;
return 0;
}
int main(){
int a,b,c,i=1;
for(;;){
cin>>a>>b>>c;
if(a==-1&&b==-1&&c==-1) break;
else w(a,b,c);
}
for(int d=1;d<=i;d++) cout<<"w("<<ia[d]<<", "<<ib[d]<<", "<<ic[d]<<") = "<<ans[d]<<endl;
}
by EastSnowLotus @ 2022-08-26 21:21:48
您的数组开的太大了捏
by HotDogSeller @ 2022-08-26 21:23:13
@HCGZS 您为蛤要开这么大的数组啊?你是因为这个CE掉的,装不下了。一般数组要开在
by HC_Lin @ 2022-08-26 21:28:47
@BTOI
@CoCo_Candy
收到
by HC_Lin @ 2022-08-26 21:29:43
@BTOI
@CoCo_Candy
由此入
by HC_Lin @ 2022-08-26 21:30:21
@BTOI
@CoCo_Candy
#include<iostream>
using namespace std;
int ia[9999999];
int ib[9999999];
int ic[9999999];
int ans[9999999];
int i=1;
int w(int a,int b,int c){
if(a<=0||b<=0||c<=0){
ia[i]=a;
ib[i]=b;
ic[i]=c;
ans[i]=1;
i++;
return 0;
}
else if(a>20||b>20||c>20){
w(20,20,20);
i++;
return 0;
}
else if(a<b&&b<c){
int d=w(a,b,c-1);
int e=w(a,b-1,c-1);
int f=w(a,b-1,c);
int g=d+e-f;
ia[i]=a;
ib[i]=b;
ic[i]=c;
ans[i]=g;
i++;
return 0;
}
int d=w(a-1,b,c);
int e=w(a-1,b-1,c);
int f=w(a-1,b,c-1);
int g=w(a-1,b-1,c-1);
int h=d+e+f-g;
ia[i]=a;
ib[i]=b;
ic[i]=c;
ans[i]=h;
i++;
return 0;
}
int main(){
int a,b,c,i=1;
for(;;){
cin>>a>>b>>c;
if(a==-1&&b==-1&&c==-1) break;
else w(a,b,c);
}
for(int d=1;d<=i;d++) cout<<"w("<<ia[d]<<", "<<ib[d]<<", "<<ic[d]<<") = "<<ans[d]<<endl;
}
by HotDogSeller @ 2022-08-26 21:31:03
@HCGZS 试试把数组调小一点再运行,试试能不能玄学跑过去
by HotDogSeller @ 2022-08-26 21:31:57
不行再调小,知道不是
by EastSnowLotus @ 2022-08-27 07:58:14
我谔谔,map 了解一下?
by EastSnowLotus @ 2022-08-27 08:02:31
@HCGZS 还有,您不需要动不动全 at 一遍,总共一次我就可以看得见捏。
by HC_Lin @ 2022-08-27 17:00:06
@BTOI
玄学这种东西,我还是...
只是,这次好像不起作用了