救救孩子!!——全部RE

P1464 Function

tql tql @[Nature](/space/show?uid=122407)
by logicYZL @ 2018-11-20 15:49:43


@[logicYZL](/space/show?uid=117409) …………
by Ein_Niemand @ 2018-11-20 15:50:47


哪道题@[Nature](/space/show?uid=122407)
by logicYZL @ 2018-11-20 15:51:46


@[logicYZL](/space/show?uid=117409) 新手村1464(~~惭愧啊~~)
by Ein_Niemand @ 2018-11-20 15:52:20


你状压学完了?@[Nature](/space/show?uid=122407)
by logicYZL @ 2018-11-20 15:54:01


@[logicYZL](/space/show?uid=117409) 没啊
by Ein_Niemand @ 2018-11-20 15:54:29


惭愧 ------------ 我也全RE ------------ 代码: ``` #include<bits/stdc++.h> using namespace std; long long a,b,c,x[205][205][205]; int w(long a,long b,long c) { while(x[a][b][c]==0) { if(a<=0 or b<=0 or c<=0) return 1; else if(x[a][b][c]!=0) return x[a][b][c]; else if(a>20 or b>20 or c>20) x[a][b][c]=w(20,20,20); else if(a<b and a<c) { x[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c); } else x[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 x[a][b][c]; } int main() { while((scanf("%Ld%Ld%Ld",&a,&b,&c))==3) { memset(x,0,sizeof(x)); if(a==-1 and b==-1 and c==-1) break; else { printf("w(a, b, c) = "); printf("%Ld",w(a,b,c)); printf("\n"); } } return 0; } ```
by wsnb6666 @ 2018-12-08 21:34:51


巧了,我一直全部RE
by geray_king @ 2019-01-07 20:53:39


我知道问题所在了,那个数组溢出了,改在25的大小就够了
by geray_king @ 2019-01-07 20:57:21


|